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_WEBSTORE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_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_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class JSONResponseFetcher; | 25 class JSONResponseFetcher; |
26 class SearchResult; | 26 class SearchResult; |
27 | 27 |
28 // WebstoreProvider fetches search results from the web store server. | 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 | 29 // A "Search in web store" result will be returned if the server does not |
30 // return any results. | 30 // return any results. |
31 class WebstoreProvider : public WebserviceSearchProvider{ | 31 class WebstoreProvider : public WebserviceSearchProvider{ |
32 public: | 32 public: |
33 WebstoreProvider(Profile* profile, AppListControllerDelegate* controller); | 33 WebstoreProvider(Profile* profile, AppListControllerDelegate* controller); |
34 virtual ~WebstoreProvider(); | 34 ~WebstoreProvider() override; |
35 | 35 |
36 // SearchProvider overrides: | 36 // SearchProvider overrides: |
37 virtual void Start(const base::string16& query) override; | 37 void Start(const base::string16& query) override; |
38 virtual void Stop() override; | 38 void Stop() override; |
39 | 39 |
40 private: | 40 private: |
41 friend class app_list::test::WebstoreProviderTest; | 41 friend class app_list::test::WebstoreProviderTest; |
42 | 42 |
43 // Start the search request with |query_|. | 43 // Start the search request with |query_|. |
44 void StartQuery(); | 44 void StartQuery(); |
45 | 45 |
46 void OnWebstoreSearchFetched(scoped_ptr<base::DictionaryValue> json); | 46 void OnWebstoreSearchFetched(scoped_ptr<base::DictionaryValue> json); |
47 void ProcessWebstoreSearchResults(const base::DictionaryValue* json); | 47 void ProcessWebstoreSearchResults(const base::DictionaryValue* json); |
48 scoped_ptr<SearchResult> CreateResult(const base::DictionaryValue& dict); | 48 scoped_ptr<SearchResult> CreateResult(const base::DictionaryValue& dict); |
49 | 49 |
50 void set_webstore_search_fetched_callback(const base::Closure& callback) { | 50 void set_webstore_search_fetched_callback(const base::Closure& callback) { |
51 webstore_search_fetched_callback_ = callback; | 51 webstore_search_fetched_callback_ = callback; |
52 } | 52 } |
53 | 53 |
54 AppListControllerDelegate* controller_; | 54 AppListControllerDelegate* controller_; |
55 scoped_ptr<JSONResponseFetcher> webstore_search_; | 55 scoped_ptr<JSONResponseFetcher> webstore_search_; |
56 base::Closure webstore_search_fetched_callback_; | 56 base::Closure webstore_search_fetched_callback_; |
57 | 57 |
58 // The current query. | 58 // The current query. |
59 std::string query_; | 59 std::string query_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); | 61 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); |
62 }; | 62 }; |
63 | 63 |
64 } // namespace app_list | 64 } // namespace app_list |
65 | 65 |
66 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ | 66 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ |
OLD | NEW |