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 <memory> |
| 9 |
8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "chrome/browser/ui/app_list/search/common/webservice_search_provider.h" | 12 #include "chrome/browser/ui/app_list/search/common/webservice_search_provider.h" |
12 | 13 |
13 class AppListControllerDelegate; | 14 class AppListControllerDelegate; |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class DictionaryValue; | 17 class DictionaryValue; |
17 } | 18 } |
18 | 19 |
19 namespace app_list { | 20 namespace app_list { |
20 | 21 |
(...skipping 16 matching lines...) Expand all Loading... |
37 // SearchProvider overrides: | 38 // SearchProvider overrides: |
38 void Start(bool is_voice_query, const base::string16& query) override; | 39 void Start(bool is_voice_query, const base::string16& query) override; |
39 void Stop() override; | 40 void Stop() override; |
40 | 41 |
41 private: | 42 private: |
42 friend class app_list::test::WebstoreProviderTest; | 43 friend class app_list::test::WebstoreProviderTest; |
43 | 44 |
44 // Start the search request with |query_|. | 45 // Start the search request with |query_|. |
45 void StartQuery(); | 46 void StartQuery(); |
46 | 47 |
47 void OnWebstoreSearchFetched(scoped_ptr<base::DictionaryValue> json); | 48 void OnWebstoreSearchFetched(std::unique_ptr<base::DictionaryValue> json); |
48 void ProcessWebstoreSearchResults(const base::DictionaryValue* json); | 49 void ProcessWebstoreSearchResults(const base::DictionaryValue* json); |
49 scoped_ptr<SearchResult> CreateResult(const TokenizedString& query, | 50 std::unique_ptr<SearchResult> CreateResult(const TokenizedString& query, |
50 const base::DictionaryValue& dict); | 51 const base::DictionaryValue& dict); |
51 | 52 |
52 void set_webstore_search_fetched_callback(const base::Closure& callback) { | 53 void set_webstore_search_fetched_callback(const base::Closure& callback) { |
53 webstore_search_fetched_callback_ = callback; | 54 webstore_search_fetched_callback_ = callback; |
54 } | 55 } |
55 | 56 |
56 AppListControllerDelegate* controller_; | 57 AppListControllerDelegate* controller_; |
57 scoped_ptr<JSONResponseFetcher> webstore_search_; | 58 std::unique_ptr<JSONResponseFetcher> webstore_search_; |
58 base::Closure webstore_search_fetched_callback_; | 59 base::Closure webstore_search_fetched_callback_; |
59 | 60 |
60 // The current query. | 61 // The current query. |
61 std::string query_; | 62 std::string query_; |
62 | 63 |
63 // Whether there is currently a query pending. | 64 // Whether there is currently a query pending. |
64 bool query_pending_; | 65 bool query_pending_; |
65 | 66 |
66 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); | 67 DISALLOW_COPY_AND_ASSIGN(WebstoreProvider); |
67 }; | 68 }; |
68 | 69 |
69 } // namespace app_list | 70 } // namespace app_list |
70 | 71 |
71 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ | 72 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_WEBSTORE_WEBSTORE_PROVIDER_H_ |
OLD | NEW |