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

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

Issue 2843813002: Remove SetWithoutPathExpansion (Closed)
Patch Set: Fix CrOS Error Created 3 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 | « tools/json_schema_compiler/test/test_util.cc ('k') | no next file » | 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/history_data_store.h" 5 #include "ui/app_list/search/history_data_store.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 void HistoryDataStore::SetSecondary( 160 void HistoryDataStore::SetSecondary(
161 const std::string& query, 161 const std::string& query,
162 const HistoryData::SecondaryDeque& results) { 162 const HistoryData::SecondaryDeque& results) {
163 std::unique_ptr<base::ListValue> results_list(new base::ListValue); 163 std::unique_ptr<base::ListValue> results_list(new base::ListValue);
164 for (size_t i = 0; i < results.size(); ++i) 164 for (size_t i = 0; i < results.size(); ++i)
165 results_list->AppendString(results[i]); 165 results_list->AppendString(results[i]);
166 166
167 base::DictionaryValue* entry_dict = GetEntryDict(query); 167 base::DictionaryValue* entry_dict = GetEntryDict(query);
168 entry_dict->SetWithoutPathExpansion(kKeySecondary, results_list.release()); 168 entry_dict->SetWithoutPathExpansion(kKeySecondary, std::move(results_list));
169 if (data_store_.get()) 169 if (data_store_.get())
170 data_store_->ScheduleWrite(); 170 data_store_->ScheduleWrite();
171 } 171 }
172 172
173 void HistoryDataStore::SetUpdateTime(const std::string& query, 173 void HistoryDataStore::SetUpdateTime(const std::string& query,
174 const base::Time& update_time) { 174 const base::Time& update_time) {
175 base::DictionaryValue* entry_dict = GetEntryDict(query); 175 base::DictionaryValue* entry_dict = GetEntryDict(query);
176 entry_dict->SetStringWithoutPathExpansion( 176 entry_dict->SetStringWithoutPathExpansion(
177 kKeyUpdateTime, base::Int64ToString(update_time.ToInternalValue())); 177 kKeyUpdateTime, base::Int64ToString(update_time.ToInternalValue()));
178 if (data_store_.get()) 178 if (data_store_.get())
(...skipping 19 matching lines...) Expand all
198 return assoc_dict; 198 return assoc_dict;
199 } 199 }
200 200
201 base::DictionaryValue* HistoryDataStore::GetEntryDict( 201 base::DictionaryValue* HistoryDataStore::GetEntryDict(
202 const std::string& query) { 202 const std::string& query) {
203 base::DictionaryValue* assoc_dict = GetAssociationDict(); 203 base::DictionaryValue* assoc_dict = GetAssociationDict();
204 204
205 base::DictionaryValue* entry_dict = nullptr; 205 base::DictionaryValue* entry_dict = nullptr;
206 if (!assoc_dict->GetDictionaryWithoutPathExpansion(query, &entry_dict)) { 206 if (!assoc_dict->GetDictionaryWithoutPathExpansion(query, &entry_dict)) {
207 // Creates one if none exists. Ownership is taken in the set call after. 207 // Creates one if none exists. Ownership is taken in the set call after.
208 entry_dict = new base::DictionaryValue; 208 assoc_dict->SetWithoutPathExpansion(
209 assoc_dict->SetWithoutPathExpansion(query, base::WrapUnique(entry_dict)); 209 query, base::MakeUnique<base::DictionaryValue>());
210 assoc_dict->GetDictionaryWithoutPathExpansion(query, &entry_dict);
210 } 211 }
211 212
212 return entry_dict; 213 return entry_dict;
213 } 214 }
214 215
215 void HistoryDataStore::OnDictionaryLoadedCallback( 216 void HistoryDataStore::OnDictionaryLoadedCallback(
216 OnLoadedCallback callback, 217 OnLoadedCallback callback,
217 std::unique_ptr<base::DictionaryValue> dict) { 218 std::unique_ptr<base::DictionaryValue> dict) {
218 if (!dict) { 219 if (!dict) {
219 callback.Run(nullptr); 220 callback.Run(nullptr);
220 } else { 221 } else {
221 callback.Run(Parse(std::move(dict))); 222 callback.Run(Parse(std::move(dict)));
222 } 223 }
223 } 224 }
224 225
225 } // namespace app_list 226 } // namespace app_list
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698