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

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: 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 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return; 188 return;
189 } 189 }
190 190
191 GURL automated_claim_url(base::StringPrintf( 191 GURL automated_claim_url(base::StringPrintf(
192 kPrivetAutomatedClaimURLFormat, 192 kPrivetAutomatedClaimURLFormat,
193 device_descriptions_[current_http_device_].url.c_str(), 193 device_descriptions_[current_http_device_].url.c_str(),
194 token.c_str())); 194 token.c_str()));
195 195
196 Profile* profile = Profile::FromWebUI(web_ui()); 196 Profile* profile = Profile::FromWebUI(web_ui());
197 197
198 OAuth2TokenService* token_service = 198 ProfileOAuth2TokenService* token_service =
199 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 199 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
200 200
201 if (!token_service) { 201 if (!token_service) {
202 LogRegisterErrorToWeb("Could not get token service"); 202 LogRegisterErrorToWeb("Could not get token service");
203 return; 203 return;
204 } 204 }
205 205
206 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( 206 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow(
207 profile->GetRequestContext(), 207 profile->GetRequestContext(),
208 token_service, 208 token_service,
209 token_service->GetPrimaryAccountId(),
209 automated_claim_url, 210 automated_claim_url,
210 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, 211 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone,
211 base::Unretained(this)))); 212 base::Unretained(this))));
212 213
213 confirm_api_call_flow_->Start(); 214 confirm_api_call_flow_->Start();
214 } 215 }
215 216
216 void LocalDiscoveryUIHandler::OnPrivetRegisterError( 217 void LocalDiscoveryUIHandler::OnPrivetRegisterError(
217 const std::string& action, 218 const std::string& action,
218 PrivetRegisterOperation::FailureReason reason, 219 PrivetRegisterOperation::FailureReason reason,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 const base::DictionaryValue* json_value) { 299 const base::DictionaryValue* json_value) {
299 if (http_code != net::HTTP_OK || !json_value) { 300 if (http_code != net::HTTP_OK || !json_value) {
300 LogInfoErrorToWeb(base::StringPrintf("HTTP error %d", http_code)); 301 LogInfoErrorToWeb(base::StringPrintf("HTTP error %d", http_code));
301 return; 302 return;
302 } 303 }
303 304
304 web_ui()->CallJavascriptFunction("local_discovery.renderInfo", *json_value); 305 web_ui()->CallJavascriptFunction("local_discovery.renderInfo", *json_value);
305 } 306 }
306 307
307 } // namespace local_discovery 308 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698