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 #include "chrome/browser/ui/app_list/search/people/people_provider.h" | 5 #include "chrome/browser/ui/app_list/search/people/people_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 const GoogleServiceAuthError& error) { | 121 const GoogleServiceAuthError& error) { |
122 DCHECK_EQ(access_token_request_, request); | 122 DCHECK_EQ(access_token_request_, request); |
123 access_token_request_.reset(); | 123 access_token_request_.reset(); |
124 } | 124 } |
125 | 125 |
126 void PeopleProvider::RequestAccessToken() { | 126 void PeopleProvider::RequestAccessToken() { |
127 // Only one active request at a time. | 127 // Only one active request at a time. |
128 if (access_token_request_ != NULL) | 128 if (access_token_request_ != NULL) |
129 return; | 129 return; |
130 | 130 |
131 OAuth2TokenService* token_service = | 131 ProfileOAuth2TokenService* token_service = |
132 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 132 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
133 access_token_request_ = token_service->StartRequest(oauth2_scope_, this); | 133 access_token_request_ = token_service->StartRequest( |
| 134 token_service->GetPrimaryAccountId(), oauth2_scope_, this); |
134 } | 135 } |
135 | 136 |
136 GURL PeopleProvider::GetQueryUrl(const std::string& query) { | 137 GURL PeopleProvider::GetQueryUrl(const std::string& query) { |
137 GURL people_search_url = people_search_url_; | 138 GURL people_search_url = people_search_url_; |
138 people_search_url = net::AppendQueryParameter(people_search_url, | 139 people_search_url = net::AppendQueryParameter(people_search_url, |
139 kAccessTokenField, | 140 kAccessTokenField, |
140 access_token_); | 141 access_token_); |
141 people_search_url = net::AppendQueryParameter(people_search_url, | 142 people_search_url = net::AppendQueryParameter(people_search_url, |
142 kQueryField, | 143 kQueryField, |
143 query); | 144 query); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 246 |
246 void PeopleProvider::SetupForTest( | 247 void PeopleProvider::SetupForTest( |
247 const base::Closure& people_search_fetched_callback, | 248 const base::Closure& people_search_fetched_callback, |
248 const GURL& people_search_url) { | 249 const GURL& people_search_url) { |
249 people_search_fetched_callback_ = people_search_fetched_callback; | 250 people_search_fetched_callback_ = people_search_fetched_callback; |
250 people_search_url_ = people_search_url; | 251 people_search_url_ = people_search_url; |
251 skip_request_token_for_test_ = true; | 252 skip_request_token_for_test_ = true; |
252 } | 253 } |
253 | 254 |
254 } // namespace app_list | 255 } // namespace app_list |
OLD | NEW |