OLD | NEW |
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 std::string base_url = GetCloudPrintBaseUrl(current_http_client_->GetName()); | 175 std::string base_url = GetCloudPrintBaseUrl(current_http_client_->GetName()); |
176 | 176 |
177 GURL automated_claim_url(base::StringPrintf( | 177 GURL automated_claim_url(base::StringPrintf( |
178 kPrivetAutomatedClaimURLFormat, | 178 kPrivetAutomatedClaimURLFormat, |
179 base_url.c_str(), | 179 base_url.c_str(), |
180 token.c_str())); | 180 token.c_str())); |
181 | 181 |
182 Profile* profile = Profile::FromWebUI(web_ui()); | 182 Profile* profile = Profile::FromWebUI(web_ui()); |
183 | 183 |
184 if (current_register_user_index_ == kAccountIndexUseOAuth2) { | 184 if (current_register_user_index_ == kAccountIndexUseOAuth2) { |
185 OAuth2TokenService* token_service = | 185 ProfileOAuth2TokenService* token_service = |
186 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 186 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
187 | 187 |
188 if (!token_service) { | 188 if (!token_service) { |
189 SendRegisterError(); | 189 SendRegisterError(); |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( | 193 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( |
194 profile->GetRequestContext(), | 194 profile->GetRequestContext(), |
195 token_service, | 195 token_service, |
| 196 token_service->GetPrimaryAccountId(), |
196 automated_claim_url, | 197 automated_claim_url, |
197 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, | 198 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, |
198 base::Unretained(this)))); | 199 base::Unretained(this)))); |
199 confirm_api_call_flow_->Start(); | 200 confirm_api_call_flow_->Start(); |
200 } else { | 201 } else { |
201 if (current_register_user_index_ == 0) { | 202 if (current_register_user_index_ == 0) { |
202 StartCookieConfirmFlow(current_register_user_index_, | 203 StartCookieConfirmFlow(current_register_user_index_, |
203 xsrf_token_for_primary_user_, | 204 xsrf_token_for_primary_user_, |
204 automated_claim_url); | 205 automated_claim_url); |
205 } else { | 206 } else { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 373 |
373 confirm_api_call_flow_.reset(); | 374 confirm_api_call_flow_.reset(); |
374 privet_resolution_.reset(); | 375 privet_resolution_.reset(); |
375 cloud_print_account_manager_.reset(); | 376 cloud_print_account_manager_.reset(); |
376 xsrf_token_for_primary_user_.clear(); | 377 xsrf_token_for_primary_user_.clear(); |
377 current_register_user_index_ = 0; | 378 current_register_user_index_ = 0; |
378 current_http_client_.reset(); | 379 current_http_client_.reset(); |
379 } | 380 } |
380 | 381 |
381 } // namespace local_discovery | 382 } // namespace local_discovery |
OLD | NEW |