Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: chrome/browser/ui/app_list/search/people/people_provider.cc

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 const GoogleServiceAuthError& error) { 111 const GoogleServiceAuthError& error) {
112 DCHECK_EQ(access_token_request_, request); 112 DCHECK_EQ(access_token_request_, request);
113 access_token_request_.reset(); 113 access_token_request_.reset();
114 } 114 }
115 115
116 void PeopleProvider::RequestAccessToken() { 116 void PeopleProvider::RequestAccessToken() {
117 // Only one active request at a time. 117 // Only one active request at a time.
118 if (access_token_request_ != NULL) 118 if (access_token_request_ != NULL)
119 return; 119 return;
120 120
121 ProfileOAuth2TokenService* token_service =
122 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
123 SigninManagerBase* signin_manager = 121 SigninManagerBase* signin_manager =
124 SigninManagerFactory::GetInstance()->GetForProfile(profile_); 122 SigninManagerFactory::GetInstance()->GetForProfile(profile_);
125 access_token_request_ = token_service->StartRequest( 123 if (signin_manager->IsAuthenticated()) {
126 signin_manager->GetAuthenticatedAccountId(), oauth2_scope_, this); 124 ProfileOAuth2TokenService* token_service =
125 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
126 access_token_request_ = token_service->StartRequest(
127 signin_manager->GetAuthenticatedAccountId(), oauth2_scope_, this);
128 }
127 } 129 }
128 130
129 GURL PeopleProvider::GetQueryUrl(const std::string& query) { 131 GURL PeopleProvider::GetQueryUrl(const std::string& query) {
130 GURL people_search_url = people_search_url_; 132 GURL people_search_url = people_search_url_;
131 people_search_url = net::AppendQueryParameter(people_search_url, 133 people_search_url = net::AppendQueryParameter(people_search_url,
132 kAccessTokenField, 134 kAccessTokenField,
133 access_token_); 135 access_token_);
134 people_search_url = net::AppendQueryParameter(people_search_url, 136 people_search_url = net::AppendQueryParameter(people_search_url,
135 kQueryField, 137 kQueryField,
136 query); 138 query);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 198
197 void PeopleProvider::SetupForTest( 199 void PeopleProvider::SetupForTest(
198 const base::Closure& people_search_fetched_callback, 200 const base::Closure& people_search_fetched_callback,
199 const GURL& people_search_url) { 201 const GURL& people_search_url) {
200 people_search_fetched_callback_ = people_search_fetched_callback; 202 people_search_fetched_callback_ = people_search_fetched_callback;
201 people_search_url_ = people_search_url; 203 people_search_url_ = people_search_url;
202 skip_request_token_for_test_ = true; 204 skip_request_token_for_test_ = true;
203 } 205 }
204 206
205 } // namespace app_list 207 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698