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

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: Rebasing to include the update to ProfileSyncService: r224220 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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 void LocalDiscoveryUIHandler::HandleCancelRegistration( 144 void LocalDiscoveryUIHandler::HandleCancelRegistration(
145 const base::ListValue* args) { 145 const base::ListValue* args) {
146 ResetCurrentRegistration(); 146 ResetCurrentRegistration();
147 } 147 }
148 148
149 void LocalDiscoveryUIHandler::HandleRequestPrinterList( 149 void LocalDiscoveryUIHandler::HandleRequestPrinterList(
150 const base::ListValue* args) { 150 const base::ListValue* args) {
151 Profile* profile = Profile::FromWebUI(web_ui()); 151 Profile* profile = Profile::FromWebUI(web_ui());
152 OAuth2TokenService* token_service = 152 ProfileOAuth2TokenService* token_service =
153 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 153 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
154 154
155 cloud_print_printer_list_.reset(new CloudPrintPrinterList( 155 cloud_print_printer_list_.reset(new CloudPrintPrinterList(
156 profile->GetRequestContext(), 156 profile->GetRequestContext(),
157 GetCloudPrintBaseUrl(), 157 GetCloudPrintBaseUrl(),
158 token_service, 158 token_service,
159 token_service->GetPrimaryAccountId(),
159 this)); 160 this));
160 cloud_print_printer_list_->Start(); 161 cloud_print_printer_list_->Start();
161 } 162 }
162 163
163 void LocalDiscoveryUIHandler::HandleOpenCloudPrintURL( 164 void LocalDiscoveryUIHandler::HandleOpenCloudPrintURL(
164 const base::ListValue* args) { 165 const base::ListValue* args) {
165 std::string url; 166 std::string url;
166 bool rv = args->GetString(0, &url); 167 bool rv = args->GetString(0, &url);
167 DCHECK(rv); 168 DCHECK(rv);
168 169
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 std::string base_url = GetCloudPrintBaseUrl(); 224 std::string base_url = GetCloudPrintBaseUrl();
224 225
225 GURL automated_claim_url(base::StringPrintf( 226 GURL automated_claim_url(base::StringPrintf(
226 kPrivetAutomatedClaimURLFormat, 227 kPrivetAutomatedClaimURLFormat,
227 base_url.c_str(), 228 base_url.c_str(),
228 token.c_str())); 229 token.c_str()));
229 230
230 Profile* profile = Profile::FromWebUI(web_ui()); 231 Profile* profile = Profile::FromWebUI(web_ui());
231 232
232 OAuth2TokenService* token_service = 233 ProfileOAuth2TokenService* token_service =
233 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 234 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
234 235
235 if (!token_service) { 236 if (!token_service) {
236 SendRegisterError(); 237 SendRegisterError();
237 return; 238 return;
238 } 239 }
239 240
240 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( 241 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow(
241 profile->GetRequestContext(), 242 profile->GetRequestContext(),
242 token_service, 243 token_service,
244 token_service->GetPrimaryAccountId(),
243 automated_claim_url, 245 automated_claim_url,
244 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, 246 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone,
245 base::Unretained(this)))); 247 base::Unretained(this))));
246 confirm_api_call_flow_->Start(); 248 confirm_api_call_flow_->Start();
247 } 249 }
248 250
249 void LocalDiscoveryUIHandler::OnPrivetRegisterError( 251 void LocalDiscoveryUIHandler::OnPrivetRegisterError(
250 PrivetRegisterOperation* operation, 252 PrivetRegisterOperation* operation,
251 const std::string& action, 253 const std::string& action,
252 PrivetRegisterOperation::FailureReason reason, 254 PrivetRegisterOperation::FailureReason reason,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 return return_value.Pass(); 436 return return_value.Pass();
435 } 437 }
436 438
437 void LocalDiscoveryUIHandler::CheckUserLoggedIn() { 439 void LocalDiscoveryUIHandler::CheckUserLoggedIn() {
438 base::FundamentalValue logged_in_value(!GetSyncAccount().empty()); 440 base::FundamentalValue logged_in_value(!GetSyncAccount().empty());
439 web_ui()->CallJavascriptFunction("local_discovery.setUserLoggedIn", 441 web_ui()->CallJavascriptFunction("local_discovery.setUserLoggedIn",
440 logged_in_value); 442 logged_in_value);
441 } 443 }
442 444
443 } // namespace local_discovery 445 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/ui/auto_login_prompter.cc ('k') | chrome/browser/ui/webui/print_preview/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698