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_PEOPLE_PEOPLE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_PROVIDER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_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" |
11 #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" |
12 #include "google_apis/gaia/oauth2_token_service.h" | 12 #include "google_apis/gaia/oauth2_token_service.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 class AppListControllerDelegate; | 15 class AppListControllerDelegate; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class DictionaryValue; | 18 class DictionaryValue; |
19 } | 19 } |
20 | 20 |
21 namespace app_list { | 21 namespace app_list { |
22 | 22 |
23 namespace test { | 23 namespace test { |
24 class PeopleProviderTest; | 24 class PeopleProviderTest; |
25 } | 25 } |
26 | 26 |
27 class ChromeSearchResult; | |
28 class JSONResponseFetcher; | 27 class JSONResponseFetcher; |
| 28 class SearchResult; |
29 | 29 |
30 // PeopleProvider fetches search results from the web store server. | 30 // PeopleProvider fetches search results from the web store server. |
31 // A "Search in web store" result will be returned if the server does not | 31 // A "Search in web store" result will be returned if the server does not |
32 // return any results. | 32 // return any results. |
33 class PeopleProvider : public WebserviceSearchProvider, | 33 class PeopleProvider : public WebserviceSearchProvider, |
34 public OAuth2TokenService::Consumer { | 34 public OAuth2TokenService::Consumer { |
35 public: | 35 public: |
36 explicit PeopleProvider(Profile* profile); | 36 explicit PeopleProvider(Profile* profile); |
37 virtual ~PeopleProvider(); | 37 virtual ~PeopleProvider(); |
38 | 38 |
(...skipping 21 matching lines...) Expand all Loading... |
60 // Get the full people search query URL. This URL includes the OAuth refresh | 60 // Get the full people search query URL. This URL includes the OAuth refresh |
61 // token for authenticating the current user. | 61 // token for authenticating the current user. |
62 GURL GetQueryUrl(const std::string& query); | 62 GURL GetQueryUrl(const std::string& query); |
63 | 63 |
64 // Start the search request with |query_|. | 64 // Start the search request with |query_|. |
65 void StartQuery(); | 65 void StartQuery(); |
66 | 66 |
67 // Callback for people search results being fetched. | 67 // Callback for people search results being fetched. |
68 void OnPeopleSearchFetched(scoped_ptr<base::DictionaryValue> json); | 68 void OnPeopleSearchFetched(scoped_ptr<base::DictionaryValue> json); |
69 void ProcessPeopleSearchResults(const base::DictionaryValue* json); | 69 void ProcessPeopleSearchResults(const base::DictionaryValue* json); |
70 scoped_ptr<ChromeSearchResult> CreateResult( | 70 scoped_ptr<SearchResult> CreateResult(const base::DictionaryValue& dict); |
71 const base::DictionaryValue& dict); | |
72 | 71 |
73 // Setup the various variables that we override for testing. | 72 // Setup the various variables that we override for testing. |
74 void SetupForTest(const base::Closure& people_search_fetched_callback, | 73 void SetupForTest(const base::Closure& people_search_fetched_callback, |
75 const GURL& people_search_url); | 74 const GURL& people_search_url); |
76 | 75 |
77 scoped_ptr<JSONResponseFetcher> people_search_; | 76 scoped_ptr<JSONResponseFetcher> people_search_; |
78 base::Closure people_search_fetched_callback_; | 77 base::Closure people_search_fetched_callback_; |
79 | 78 |
80 std::string access_token_; | 79 std::string access_token_; |
81 scoped_ptr<OAuth2TokenService::Request> access_token_request_; | 80 scoped_ptr<OAuth2TokenService::Request> access_token_request_; |
82 OAuth2TokenService::ScopeSet oauth2_scope_; | 81 OAuth2TokenService::ScopeSet oauth2_scope_; |
83 | 82 |
84 // The current query. | 83 // The current query. |
85 std::string query_; | 84 std::string query_; |
86 GURL people_search_url_; | 85 GURL people_search_url_; |
87 | 86 |
88 bool skip_request_token_for_test_; | 87 bool skip_request_token_for_test_; |
89 | 88 |
90 DISALLOW_COPY_AND_ASSIGN(PeopleProvider); | 89 DISALLOW_COPY_AND_ASSIGN(PeopleProvider); |
91 }; | 90 }; |
92 | 91 |
93 } // namespace app_list | 92 } // namespace app_list |
94 | 93 |
95 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_PROVIDER_H_ | 94 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_PROVIDER_H_ |
OLD | NEW |