| 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 <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 #include "google_apis/gaia/oauth2_token_service.h" | 13 #include "google_apis/gaia/oauth2_token_service.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 15 class AppListControllerDelegate; | 16 class AppListControllerDelegate; |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class DictionaryValue; | 19 class DictionaryValue; |
| 19 } | 20 } |
| 20 | 21 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void InvalidateToken(); | 57 void InvalidateToken(); |
| 57 | 58 |
| 58 // Get the full people search query URL. This URL includes the OAuth refresh | 59 // Get the full people search query URL. This URL includes the OAuth refresh |
| 59 // token for authenticating the current user. | 60 // token for authenticating the current user. |
| 60 GURL GetQueryUrl(const std::string& query); | 61 GURL GetQueryUrl(const std::string& query); |
| 61 | 62 |
| 62 // Start the search request with |query_|. | 63 // Start the search request with |query_|. |
| 63 void StartQuery(); | 64 void StartQuery(); |
| 64 | 65 |
| 65 // Callback for people search results being fetched. | 66 // Callback for people search results being fetched. |
| 66 void OnPeopleSearchFetched(scoped_ptr<base::DictionaryValue> json); | 67 void OnPeopleSearchFetched(std::unique_ptr<base::DictionaryValue> json); |
| 67 void ProcessPeopleSearchResults(const base::DictionaryValue* json); | 68 void ProcessPeopleSearchResults(const base::DictionaryValue* json); |
| 68 scoped_ptr<SearchResult> CreateResult(const base::DictionaryValue& dict); | 69 std::unique_ptr<SearchResult> CreateResult(const base::DictionaryValue& dict); |
| 69 | 70 |
| 70 // Setup the various variables that we override for testing. | 71 // Setup the various variables that we override for testing. |
| 71 void SetupForTest(const base::Closure& people_search_fetched_callback, | 72 void SetupForTest(const base::Closure& people_search_fetched_callback, |
| 72 const GURL& people_search_url); | 73 const GURL& people_search_url); |
| 73 | 74 |
| 74 AppListControllerDelegate* controller_; | 75 AppListControllerDelegate* controller_; |
| 75 scoped_ptr<JSONResponseFetcher> people_search_; | 76 std::unique_ptr<JSONResponseFetcher> people_search_; |
| 76 base::Closure people_search_fetched_callback_; | 77 base::Closure people_search_fetched_callback_; |
| 77 | 78 |
| 78 std::string access_token_; | 79 std::string access_token_; |
| 79 scoped_ptr<OAuth2TokenService::Request> access_token_request_; | 80 std::unique_ptr<OAuth2TokenService::Request> access_token_request_; |
| 80 OAuth2TokenService::ScopeSet oauth2_scope_; | 81 OAuth2TokenService::ScopeSet oauth2_scope_; |
| 81 | 82 |
| 82 // The current query. | 83 // The current query. |
| 83 std::string query_; | 84 std::string query_; |
| 84 GURL people_search_url_; | 85 GURL people_search_url_; |
| 85 | 86 |
| 86 bool skip_request_token_for_test_; | 87 bool skip_request_token_for_test_; |
| 87 | 88 |
| 88 DISALLOW_COPY_AND_ASSIGN(PeopleProvider); | 89 DISALLOW_COPY_AND_ASSIGN(PeopleProvider); |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace app_list | 92 } // namespace app_list |
| 92 | 93 |
| 93 #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 |