Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: ui/app_list/search/dictionary_data_store.cc

Issue 1924743005: Move away from deprecated base::Value methods in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/app_list/search/history_data_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/search/dictionary_data_store.h" 5 #include "ui/app_list/search/dictionary_data_store.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
11 #include "base/json/json_string_value_serializer.h" 11 #include "base/json/json_string_value_serializer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
14 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
15 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
16 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
17 #include "base/threading/sequenced_worker_pool.h" 16 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/values.h" 17 #include "base/values.h"
19 18
20 namespace app_list { 19 namespace app_list {
21 20
22 DictionaryDataStore::DictionaryDataStore(const base::FilePath& data_file, 21 DictionaryDataStore::DictionaryDataStore(const base::FilePath& data_file,
23 base::SequencedWorkerPool* worker_pool) 22 base::SequencedWorkerPool* worker_pool)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 std::string error_message; 71 std::string error_message;
73 JSONFileValueDeserializer deserializer(data_file_); 72 JSONFileValueDeserializer deserializer(data_file_);
74 std::unique_ptr<base::DictionaryValue> dict_value = 73 std::unique_ptr<base::DictionaryValue> dict_value =
75 base::DictionaryValue::From( 74 base::DictionaryValue::From(
76 deserializer.Deserialize(&error_code, &error_message)); 75 deserializer.Deserialize(&error_code, &error_message));
77 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || !dict_value) { 76 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || !dict_value) {
78 return nullptr; 77 return nullptr;
79 } 78 }
80 79
81 std::unique_ptr<base::DictionaryValue> return_dict = 80 std::unique_ptr<base::DictionaryValue> return_dict =
82 base::WrapUnique(dict_value.get()->DeepCopy()); 81 dict_value->CreateDeepCopy();
83 cached_dict_ = std::move(dict_value); 82 cached_dict_ = std::move(dict_value);
84 return return_dict; 83 return return_dict;
85 } 84 }
86 85
87 bool DictionaryDataStore::SerializeData(std::string* data) { 86 bool DictionaryDataStore::SerializeData(std::string* data) {
88 JSONStringValueSerializer serializer(data); 87 JSONStringValueSerializer serializer(data);
89 serializer.set_pretty_print(true); 88 serializer.set_pretty_print(true);
90 return serializer.Serialize(*cached_dict_.get()); 89 return serializer.Serialize(*cached_dict_.get());
91 } 90 }
92 91
93 } // namespace app_list 92 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/search/history_data_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698