Fix API changes of Chrome58

This commit is contained in:
Cheng Zhao 2017-04-04 13:50:44 +09:00
parent 453cb2c0b4
commit fc2d62d5cb
28 changed files with 73 additions and 105 deletions

View file

@ -181,7 +181,7 @@ bool Archive::Init() {
std::string error;
base::JSONReader reader;
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
if (!value || !value->IsType(base::Value::TYPE::DICTIONARY)) {
LOG(ERROR) << "Failed to parse header: " << error;
return false;
}
@ -269,8 +269,9 @@ bool Archive::Realpath(const base::FilePath& path, base::FilePath* realpath) {
}
bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) {
if (external_files_.contains(path)) {
*out = external_files_.get(path)->path();
auto it = external_files_.find(path.value());
if (it != external_files_.end()) {
*out = it->second->path();
return true;
}
@ -296,7 +297,7 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) {
#endif
*out = temp_file->path();
external_files_.set(path, std::move(temp_file));
external_files_[path.value()] = std::move(temp_file);
return true;
}

View file

@ -6,9 +6,9 @@
#define ATOM_COMMON_ASAR_ARCHIVE_H_
#include <memory>
#include <unordered_map>
#include <vector>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
@ -75,8 +75,8 @@ class Archive {
std::unique_ptr<base::DictionaryValue> header_;
// Cached external temporary files.
base::ScopedPtrHashMap<base::FilePath, std::unique_ptr<ScopedTemporaryFile>>
external_files_;
std::unordered_map<base::FilePath::StringType,
std::unique_ptr<ScopedTemporaryFile>> external_files_;
DISALLOW_COPY_AND_ASSIGN(Archive);
};

View file

@ -198,7 +198,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
case base::Value::TYPE_LIST:
return ToV8Array(isolate, static_cast<const base::ListValue*>(value));
case base::Value::TYPE_DICTIONARY:
case base::Value::TYPE::DICTIONARY:
return ToV8Object(isolate,
static_cast<const base::DictionaryValue*>(value));

View file

@ -15,7 +15,7 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext()));
if (value && value->IsType(base::Value::TYPE_DICTIONARY)) {
if (value && value->IsType(base::Value::TYPE::DICTIONARY)) {
out->Swap(static_cast<base::DictionaryValue*>(value.get()));
return true;
} else {