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

Side by Side Diff: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 years, 3 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/webui/local_discovery/local_discovery_ui_handler.h" 5 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" 10 #include "chrome/browser/local_discovery/privet_device_lister_impl.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::string base_url = GetCloudPrintBaseUrl(current_http_client_->GetName()); 166 std::string base_url = GetCloudPrintBaseUrl(current_http_client_->GetName());
167 167
168 GURL automated_claim_url(base::StringPrintf( 168 GURL automated_claim_url(base::StringPrintf(
169 kPrivetAutomatedClaimURLFormat, 169 kPrivetAutomatedClaimURLFormat,
170 base_url.c_str(), 170 base_url.c_str(),
171 token.c_str())); 171 token.c_str()));
172 172
173 Profile* profile = Profile::FromWebUI(web_ui()); 173 Profile* profile = Profile::FromWebUI(web_ui());
174 174
175 if (current_register_user_index_ == kAccountIndexUseOAuth2) { 175 if (current_register_user_index_ == kAccountIndexUseOAuth2) {
176 OAuth2TokenService* token_service = 176 ProfileOAuth2TokenService* token_service =
177 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 177 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
178 178
179 if (!token_service) { 179 if (!token_service) {
180 SendRegisterError(); 180 SendRegisterError();
181 return; 181 return;
182 } 182 }
183 183
184 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( 184 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow(
185 profile->GetRequestContext(), 185 profile->GetRequestContext(),
186 token_service, 186 token_service,
187 token_service->GetPrimaryAccountId(),
187 automated_claim_url, 188 automated_claim_url,
188 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, 189 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone,
189 base::Unretained(this)))); 190 base::Unretained(this))));
190 confirm_api_call_flow_->Start(); 191 confirm_api_call_flow_->Start();
191 } else { 192 } else {
192 if (current_register_user_index_ == 0) { 193 if (current_register_user_index_ == 0) {
193 StartCookieConfirmFlow(current_register_user_index_, 194 StartCookieConfirmFlow(current_register_user_index_,
194 xsrf_token_for_primary_user_, 195 xsrf_token_for_primary_user_,
195 automated_claim_url); 196 automated_claim_url);
196 } else { 197 } else {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 user_index, 348 user_index,
348 xsrf_token, 349 xsrf_token,
349 automated_claim_url, 350 automated_claim_url,
350 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, 351 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone,
351 base::Unretained(this)))); 352 base::Unretained(this))));
352 353
353 confirm_api_call_flow_->Start(); 354 confirm_api_call_flow_->Start();
354 } 355 }
355 356
356 } // namespace local_discovery 357 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698