Commit 60094aec authored by dcheng's avatar dcheng Committed by Commit bot

Move away from deprecated base::Value methods in //ui

BUG=581865

Review-Url: https://codereview.chromium.org/1924743005
Cr-Commit-Position: refs/heads/master@{#390295}
parent 948ab3fa
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/json/json_file_value_serializer.h" #include "base/json/json_file_value_serializer.h"
#include "base/json/json_string_value_serializer.h" #include "base/json/json_string_value_serializer.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/task_runner_util.h" #include "base/task_runner_util.h"
...@@ -79,7 +78,7 @@ DictionaryDataStore::LoadOnBlockingPool() { ...@@ -79,7 +78,7 @@ DictionaryDataStore::LoadOnBlockingPool() {
} }
std::unique_ptr<base::DictionaryValue> return_dict = std::unique_ptr<base::DictionaryValue> return_dict =
base::WrapUnique(dict_value.get()->DeepCopy()); dict_value->CreateDeepCopy();
cached_dict_ = std::move(dict_value); cached_dict_ = std::move(dict_value);
return return_dict; return return_dict;
} }
......
...@@ -145,16 +145,14 @@ void HistoryDataStore::Load( ...@@ -145,16 +145,14 @@ void HistoryDataStore::Load(
data_store_->Load(base::Bind( data_store_->Load(base::Bind(
&HistoryDataStore::OnDictionaryLoadedCallback, this, on_loaded)); &HistoryDataStore::OnDictionaryLoadedCallback, this, on_loaded));
} else { } else {
OnDictionaryLoadedCallback(on_loaded, OnDictionaryLoadedCallback(on_loaded, cached_dict_->CreateDeepCopy());
base::WrapUnique(cached_dict_->DeepCopy()));
} }
} }
void HistoryDataStore::SetPrimary(const std::string& query, void HistoryDataStore::SetPrimary(const std::string& query,
const std::string& result) { const std::string& result) {
base::DictionaryValue* entry_dict = GetEntryDict(query); base::DictionaryValue* entry_dict = GetEntryDict(query);
entry_dict->SetWithoutPathExpansion(kKeyPrimary, entry_dict->SetStringWithoutPathExpansion(kKeyPrimary, result);
new base::StringValue(result));
if (data_store_.get()) if (data_store_.get())
data_store_->ScheduleWrite(); data_store_->ScheduleWrite();
} }
...@@ -175,9 +173,8 @@ void HistoryDataStore::SetSecondary( ...@@ -175,9 +173,8 @@ void HistoryDataStore::SetSecondary(
void HistoryDataStore::SetUpdateTime(const std::string& query, void HistoryDataStore::SetUpdateTime(const std::string& query,
const base::Time& update_time) { const base::Time& update_time) {
base::DictionaryValue* entry_dict = GetEntryDict(query); base::DictionaryValue* entry_dict = GetEntryDict(query);
entry_dict->SetWithoutPathExpansion(kKeyUpdateTime, entry_dict->SetStringWithoutPathExpansion(
new base::StringValue(base::Int64ToString( kKeyUpdateTime, base::Int64ToString(update_time.ToInternalValue()));
update_time.ToInternalValue())));
if (data_store_.get()) if (data_store_.get())
data_store_->ScheduleWrite(); data_store_->ScheduleWrite();
} }
...@@ -205,11 +202,11 @@ base::DictionaryValue* HistoryDataStore::GetEntryDict( ...@@ -205,11 +202,11 @@ base::DictionaryValue* HistoryDataStore::GetEntryDict(
const std::string& query) { const std::string& query) {
base::DictionaryValue* assoc_dict = GetAssociationDict(); base::DictionaryValue* assoc_dict = GetAssociationDict();
base::DictionaryValue* entry_dict = NULL; base::DictionaryValue* entry_dict = nullptr;
if (!assoc_dict->GetDictionaryWithoutPathExpansion(query, &entry_dict)) { if (!assoc_dict->GetDictionaryWithoutPathExpansion(query, &entry_dict)) {
// Creates one if none exists. Ownership is taken in the set call after. // Creates one if none exists. Ownership is taken in the set call after.
entry_dict = new base::DictionaryValue; entry_dict = new base::DictionaryValue;
assoc_dict->SetWithoutPathExpansion(query, entry_dict); assoc_dict->SetWithoutPathExpansion(query, base::WrapUnique(entry_dict));
} }
return entry_dict; return entry_dict;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment