OLD | NEW |
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 <utility> |
| 8 |
7 #include "base/callback.h" | 9 #include "base/callback.h" |
8 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
9 #include "base/json/json_string_value_serializer.h" | 11 #include "base/json/json_string_value_serializer.h" |
10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
11 #include "base/values.h" | 13 #include "base/values.h" |
12 | 14 |
13 namespace app_list { | 15 namespace app_list { |
14 | 16 |
15 namespace { | 17 namespace { |
16 | 18 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 HistoryData::Data& association_data = (*data.get())[query]; | 94 HistoryData::Data& association_data = (*data.get())[query]; |
93 association_data.primary = primary; | 95 association_data.primary = primary; |
94 association_data.secondary.swap(secondary); | 96 association_data.secondary.swap(secondary); |
95 | 97 |
96 int64 update_time_val; | 98 int64 update_time_val; |
97 base::StringToInt64(update_time_string, &update_time_val); | 99 base::StringToInt64(update_time_string, &update_time_val); |
98 association_data.update_time = | 100 association_data.update_time = |
99 base::Time::FromInternalValue(update_time_val); | 101 base::Time::FromInternalValue(update_time_val); |
100 } | 102 } |
101 | 103 |
102 return data.Pass(); | 104 return data; |
103 } | 105 } |
104 | 106 |
105 } // namespace | 107 } // namespace |
106 | 108 |
107 HistoryDataStore::HistoryDataStore() | 109 HistoryDataStore::HistoryDataStore() |
108 : cached_dict_(new base::DictionaryValue()) { | 110 : cached_dict_(new base::DictionaryValue()) { |
109 Init(cached_dict_.get()); | 111 Init(cached_dict_.get()); |
110 } | 112 } |
111 | 113 |
112 HistoryDataStore::HistoryDataStore( | 114 HistoryDataStore::HistoryDataStore( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 209 |
208 return entry_dict; | 210 return entry_dict; |
209 } | 211 } |
210 | 212 |
211 void HistoryDataStore::OnDictionaryLoadedCallback( | 213 void HistoryDataStore::OnDictionaryLoadedCallback( |
212 OnLoadedCallback callback, | 214 OnLoadedCallback callback, |
213 scoped_ptr<base::DictionaryValue> dict) { | 215 scoped_ptr<base::DictionaryValue> dict) { |
214 if (!dict) { | 216 if (!dict) { |
215 callback.Run(nullptr); | 217 callback.Run(nullptr); |
216 } else { | 218 } else { |
217 callback.Run(Parse(dict.Pass()).Pass()); | 219 callback.Run(Parse(std::move(dict))); |
218 } | 220 } |
219 } | 221 } |
220 | 222 |
221 } // namespace app_list | 223 } // namespace app_list |
OLD | NEW |