| 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_WEBSTORE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback_forward.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/time.h" | |
| 12 #include "base/timer/timer.h" | |
| 13 #include "chrome/browser/ui/app_list/search/common/webservice_search_provider.h" | 11 #include "chrome/browser/ui/app_list/search/common/webservice_search_provider.h" |
| 14 #include "chrome/browser/ui/app_list/search/webstore_cache.h" | 12 #include "chrome/browser/ui/app_list/search/webstore/webstore_cache.h" |
| 15 | 13 |
| 16 class AppListControllerDelegate; | 14 class AppListControllerDelegate; |
| 17 class Profile; | |
| 18 | 15 |
| 19 namespace base { | 16 namespace base { |
| 20 class DictionaryValue; | 17 class DictionaryValue; |
| 21 } | 18 } |
| 22 | 19 |
| 23 namespace app_list { | 20 namespace app_list { |
| 24 | 21 |
| 25 namespace test { | 22 namespace test { |
| 26 class WebstoreProviderTest; | 23 class WebstoreProviderTest; |
| 27 } | 24 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 | 46 |
| 50 void OnWebstoreSearchFetched(scoped_ptr<base::DictionaryValue> json); | 47 void OnWebstoreSearchFetched(scoped_ptr<base::DictionaryValue> json); |
| 51 void ProcessWebstoreSearchResults(const base::DictionaryValue* json); | 48 void ProcessWebstoreSearchResults(const base::DictionaryValue* json); |
| 52 scoped_ptr<ChromeSearchResult> CreateResult( | 49 scoped_ptr<ChromeSearchResult> CreateResult( |
| 53 const base::DictionaryValue& dict); | 50 const base::DictionaryValue& dict); |
| 54 | 51 |
| 55 void set_webstore_search_fetched_callback(const base::Closure& callback) { | 52 void set_webstore_search_fetched_callback(const base::Closure& callback) { |
| 56 webstore_search_fetched_callback_ = callback; | 53 webstore_search_fetched_callback_ = callback; |
| 57 } | 54 } |
| 58 | 55 |
| 59 Profile* profile_; | |
| 60 AppListControllerDelegate* controller_; | 56 AppListControllerDelegate* controller_; |
| 61 scoped_ptr<JSONResponseFetcher> webstore_search_; | 57 scoped_ptr<JSONResponseFetcher> webstore_search_; |
| 62 base::Closure webstore_search_fetched_callback_; | 58 base::Closure webstore_search_fetched_callback_; |
| 63 | 59 |
| 64 // The cache of the search result which will be valid only in a single | 60 // The cache of the search result which will be valid only in a single |
| 65 // input session. | 61 // input session. |
| 66 WebstoreCache cache_; | 62 WebstoreCache cache_; |
| 67 | 63 |
| 68 // The timestamp when the last key event happened. | |
| 69 base::Time last_keytyped_; | |
| 70 | |
| 71 // The timer to throttle QPS to the webstore search . | |
| 72 base::OneShotTimer<WebstoreProvider> query_throttler_; | |
| 73 | |
| 74 // The current query. | 64 // The current query. |
| 75 std::string query_; | 65 std::string query_; |
| 76 | 66 |
| 77 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); | 67 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); |
| 78 }; | 68 }; |
| 79 | 69 |
| 80 } // namespace app_list | 70 } // namespace app_list |
| 81 | 71 |
| 82 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_PROVIDER_H_ | 72 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ |
| OLD | NEW |