| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class JSONResponseFetcher; | 27 class JSONResponseFetcher; |
| 28 class SearchResult; | 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 PeopleProvider(Profile* profile, AppListControllerDelegate* controller); | 36 PeopleProvider(Profile* profile, AppListControllerDelegate* controller); |
| 37 virtual ~PeopleProvider(); | 37 ~PeopleProvider() override; |
| 38 | 38 |
| 39 // SearchProvider overrides: | 39 // SearchProvider overrides: |
| 40 virtual void Start(const base::string16& query) override; | 40 void Start(const base::string16& query) override; |
| 41 virtual void Stop() override; | 41 void Stop() override; |
| 42 | 42 |
| 43 // OAuth2TokenService::Consumer overrides: | 43 // OAuth2TokenService::Consumer overrides: |
| 44 virtual void OnGetTokenSuccess( | 44 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 45 const OAuth2TokenService::Request* request, | 45 const std::string& access_token, |
| 46 const std::string& access_token, | 46 const base::Time& expiration_time) override; |
| 47 const base::Time& expiration_time) override; | 47 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 48 virtual void OnGetTokenFailure( | 48 const GoogleServiceAuthError& error) override; |
| 49 const OAuth2TokenService::Request* request, | |
| 50 const GoogleServiceAuthError& error) override; | |
| 51 | 49 |
| 52 private: | 50 private: |
| 53 friend class app_list::test::PeopleProviderTest; | 51 friend class app_list::test::PeopleProviderTest; |
| 54 | 52 |
| 55 // Start a request for getting the access token for people search. | 53 // Start a request for getting the access token for people search. |
| 56 void RequestAccessToken(); | 54 void RequestAccessToken(); |
| 57 // Invalidate our existing token so a new one can be fetched. | 55 // Invalidate our existing token so a new one can be fetched. |
| 58 void InvalidateToken(); | 56 void InvalidateToken(); |
| 59 | 57 |
| 60 // Get the full people search query URL. This URL includes the OAuth refresh | 58 // Get the full people search query URL. This URL includes the OAuth refresh |
| (...skipping 25 matching lines...) Expand all Loading... |
| 86 GURL people_search_url_; | 84 GURL people_search_url_; |
| 87 | 85 |
| 88 bool skip_request_token_for_test_; | 86 bool skip_request_token_for_test_; |
| 89 | 87 |
| 90 DISALLOW_COPY_AND_ASSIGN(PeopleProvider); | 88 DISALLOW_COPY_AND_ASSIGN(PeopleProvider); |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 } // namespace app_list | 91 } // namespace app_list |
| 94 | 92 |
| 95 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_PROVIDER_H_ | 93 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PEOPLE_PEOPLE_PROVIDER_H_ |
| OLD | NEW |