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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_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: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 49a96b9949cc25db5e219a29460ce8da8aa5872d..ea12c65851c61590f13d1097f463a56446d84b7f 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -278,10 +278,15 @@ class PrintPreviewHandler::AccessTokenService
return; // Already in progress.
OAuth2TokenService* service = NULL;
+ std::string account_id;
if (type == "profile") {
Profile* profile = Profile::FromWebUI(handler_->web_ui());
- if (profile)
- service = ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
+ if (profile) {
+ ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
+ account_id = token_service->GetPrimaryAccountId();
+ service = token_service;
+ }
} else if (type == "device") {
#if defined(OS_CHROMEOS)
service = chromeos::DeviceOAuth2TokenServiceFactory::Get();
@@ -292,7 +297,7 @@ class PrintPreviewHandler::AccessTokenService
OAuth2TokenService::ScopeSet oauth_scopes;
oauth_scopes.insert(cloud_print::kCloudPrintAuth);
scoped_ptr<OAuth2TokenService::Request> request(
- service->StartRequest(oauth_scopes, this));
+ service->StartRequest(account_id, oauth_scopes, this));
requests_[type].reset(request.release());
} else {
handler_->SendAccessToken(type, std::string()); // Unknown type.

Powered by Google App Engine
This is Rietveld 408576698