OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_PROVIDER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/ui/app_list/search/search_provider.h" |
| 12 |
| 13 class Profile; |
| 14 |
| 15 namespace base { |
| 16 class DictionaryValue; |
| 17 } |
| 18 |
| 19 namespace app_list { |
| 20 |
| 21 namespace test { |
| 22 class WebstoreProviderTest; |
| 23 } |
| 24 |
| 25 class ChromeSearchResult; |
| 26 class WebstoreSearchFetcher; |
| 27 |
| 28 // WebstoreProvider fetches search results from the web store server. |
| 29 // A "Search in web store" result will be returned if the server does not |
| 30 // return any results. |
| 31 class WebstoreProvider : public SearchProvider { |
| 32 public: |
| 33 explicit WebstoreProvider(Profile* profile); |
| 34 virtual ~WebstoreProvider(); |
| 35 |
| 36 // SearchProvider overrides: |
| 37 virtual void Start(const base::string16& query) OVERRIDE; |
| 38 virtual void Stop() OVERRIDE; |
| 39 |
| 40 private: |
| 41 friend class app_list::test::WebstoreProviderTest; |
| 42 |
| 43 void OnWebstoreSearchFetched(scoped_ptr<base::DictionaryValue> json); |
| 44 void ProcessWebstoreSearchResults(base::DictionaryValue* json); |
| 45 scoped_ptr<ChromeSearchResult> CreateResult( |
| 46 const base::DictionaryValue& dict); |
| 47 |
| 48 void set_webstore_search_fetched_callback(const base::Closure& callback) { |
| 49 webstore_search_fetched_callback_ = callback; |
| 50 } |
| 51 |
| 52 Profile* profile_; |
| 53 scoped_ptr<WebstoreSearchFetcher> webstore_search_; |
| 54 base::Closure webstore_search_fetched_callback_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); |
| 57 }; |
| 58 |
| 59 } // namespace app_list |
| 60 |
| 61 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_PROVIDER_H_ |
OLD | NEW |