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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |