| 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 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const base::DictionaryValue* result) | 68 const base::DictionaryValue* result) |
| 69 : time(time), result(result) {} | 69 : time(time), result(result) {} |
| 70 Payload() {} | 70 Payload() {} |
| 71 | 71 |
| 72 base::Time time; | 72 base::Time time; |
| 73 const base::DictionaryValue* result; | 73 const base::DictionaryValue* result; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class CacheDeletor { | 76 class CacheDeletor { |
| 77 public: | 77 public: |
| 78 void operator()(Payload& payload); | 78 void operator()(const Payload& payload); |
| 79 }; | 79 }; |
| 80 typedef base::MRUCacheBase<std::string, Payload, CacheDeletor> Cache; | 80 typedef base::MRUCacheBase<std::string, Payload, CacheDeletor> Cache; |
| 81 | 81 |
| 82 // Callback for when the cache is loaded from the dictionary data store. | 82 // Callback for when the cache is loaded from the dictionary data store. |
| 83 void OnCacheLoaded(scoped_ptr<base::DictionaryValue>); | 83 void OnCacheLoaded(scoped_ptr<base::DictionaryValue>); |
| 84 | 84 |
| 85 // Populates the payload parameter with the corresponding payload stored | 85 // Populates the payload parameter with the corresponding payload stored |
| 86 // in the given dictionary. If the dictionary is invalid for any reason, | 86 // in the given dictionary. If the dictionary is invalid for any reason, |
| 87 // this method will return false. | 87 // this method will return false. |
| 88 bool PayloadFromDict(const base::DictionaryValue* dict, | 88 bool PayloadFromDict(const base::DictionaryValue* dict, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 104 scoped_refptr<DictionaryDataStore> data_store_; | 104 scoped_refptr<DictionaryDataStore> data_store_; |
| 105 | 105 |
| 106 bool cache_loaded_; | 106 bool cache_loaded_; |
| 107 | 107 |
| 108 DISALLOW_COPY_AND_ASSIGN(WebserviceCache); | 108 DISALLOW_COPY_AND_ASSIGN(WebserviceCache); |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace app_list | 111 } // namespace app_list |
| 112 | 112 |
| 113 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_H_ | 113 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_H_ |
| OLD | NEW |