| 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 "chrome/browser/ui/app_list/search/common/webservice_cache.h" | 5 #include "chrome/browser/ui/app_list/search/common/webservice_cache.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 | 11 |
| 12 namespace app_list { | 12 namespace app_list { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const unsigned int kWebserviceCacheMaxSize = 1000; | 15 const unsigned int kWebserviceCacheMaxSize = 1000; |
| 16 const unsigned int kWebserviceCacheTimeLimitInMinutes = 1; | 16 const unsigned int kWebserviceCacheTimeLimitInMinutes = 1; |
| 17 | 17 |
| 18 const char kKeyResultTime[] = "time"; | 18 const char kKeyResultTime[] = "time"; |
| 19 const char kKeyResult[] = "result"; | 19 const char kKeyResult[] = "result"; |
| 20 | 20 |
| 21 const char kWebstoreQueryPrefix[] = "webstore:"; | 21 const char kWebstoreQueryPrefix[] = "webstore:"; |
| 22 const char kPeopleQueryPrefix[] = "people:"; | 22 const char kPeopleQueryPrefix[] = "people:"; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 void WebserviceCache::CacheDeletor::operator()(Payload& payload) { | 26 void WebserviceCache::CacheDeletor::operator()(const Payload& payload) { |
| 27 delete payload.result; | 27 delete payload.result; |
| 28 } | 28 } |
| 29 | 29 |
| 30 WebserviceCache::WebserviceCache(content::BrowserContext* context) | 30 WebserviceCache::WebserviceCache(content::BrowserContext* context) |
| 31 : cache_(Cache::NO_AUTO_EVICT), | 31 : cache_(Cache::NO_AUTO_EVICT), |
| 32 cache_loaded_(false) { | 32 cache_loaded_(false) { |
| 33 const char kStoreDataFileName[] = "Webservice Search Cache"; | 33 const char kStoreDataFileName[] = "Webservice Search Cache"; |
| 34 const base::FilePath data_file = | 34 const base::FilePath data_file = |
| 35 context->GetPath().AppendASCII(kStoreDataFileName); | 35 context->GetPath().AppendASCII(kStoreDataFileName); |
| 36 data_store_ = new DictionaryDataStore( | 36 data_store_ = new DictionaryDataStore( |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 case WEBSTORE: | 154 case WEBSTORE: |
| 155 return kWebstoreQueryPrefix + query; | 155 return kWebstoreQueryPrefix + query; |
| 156 case PEOPLE: | 156 case PEOPLE: |
| 157 return kPeopleQueryPrefix + query; | 157 return kPeopleQueryPrefix + query; |
| 158 default: | 158 default: |
| 159 return query; | 159 return query; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace app_list | 163 } // namespace app_list |
| OLD | NEW |