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

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc

Issue 2594703002: Create a new profile and sign in the user. (Closed)
Patch Set: Rebase Created 3 years, 12 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/signin/inline_login_handler_impl.h" 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required = 278 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required =
279 confirm_untrusted_signin_ ? 279 confirm_untrusted_signin_ ?
280 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN : 280 OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN :
281 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; 281 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
282 282
283 bool start_signin = !HandleCrossAccountError( 283 bool start_signin = !HandleCrossAccountError(
284 result.refresh_token, confirmation_required, start_mode); 284 result.refresh_token, confirmation_required, start_mode);
285 if (start_signin) { 285 if (start_signin) {
286 CreateSyncStarter(browser, contents, current_url_, 286 CreateSyncStarter(browser, contents, current_url_,
287 signin::GetNextPageURLForPromoURL(current_url_), 287 signin::GetNextPageURLForPromoURL(current_url_),
288 result.refresh_token, start_mode, 288 result.refresh_token,
289 OneClickSigninSyncStarter::CURRENT_PROFILE, start_mode,
289 confirmation_required); 290 confirmation_required);
290 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 291 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
291 } 292 }
292 } 293 }
293 } 294 }
294 295
295 void InlineSigninHelper::CreateSyncStarter( 296 void InlineSigninHelper::CreateSyncStarter(
296 Browser* browser, 297 Browser* browser,
297 content::WebContents* contents, 298 content::WebContents* contents,
298 const GURL& current_url, 299 const GURL& current_url,
299 const GURL& continue_url, 300 const GURL& continue_url,
300 const std::string& refresh_token, 301 const std::string& refresh_token,
302 OneClickSigninSyncStarter::ProfileMode profile_mode,
301 OneClickSigninSyncStarter::StartSyncMode start_mode, 303 OneClickSigninSyncStarter::StartSyncMode start_mode,
302 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required) { 304 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required) {
303 // OneClickSigninSyncStarter will delete itself once the job is done. 305 // OneClickSigninSyncStarter will delete itself once the job is done.
304 new OneClickSigninSyncStarter( 306 new OneClickSigninSyncStarter(
305 profile_, browser, gaia_id_, email_, password_, refresh_token, start_mode, 307 profile_, browser, gaia_id_, email_, password_, refresh_token,
306 contents, confirmation_required, current_url, continue_url, 308 profile_mode, start_mode, contents, confirmation_required, current_url,
309 continue_url,
307 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); 310 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_));
308 } 311 }
309 312
310 bool InlineSigninHelper::HandleCrossAccountError( 313 bool InlineSigninHelper::HandleCrossAccountError(
311 const std::string& refresh_token, 314 const std::string& refresh_token,
312 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required, 315 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required,
313 OneClickSigninSyncStarter::StartSyncMode start_mode) { 316 OneClickSigninSyncStarter::StartSyncMode start_mode) {
314 // With force sign in enabled, cross account sign in will be rejected in the 317 // With force sign in enabled, cross account sign in will be rejected in the
315 // early stage so there is no need to show the warning page here. 318 // early stage so there is no need to show the warning page here.
316 if (signin::IsForceSigninEnabled()) 319 if (signin::IsForceSigninEnabled())
(...skipping 22 matching lines...) Expand all
339 content::WebContents* web_contents, 342 content::WebContents* web_contents,
340 const std::string& refresh_token, 343 const std::string& refresh_token,
341 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required, 344 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required,
342 OneClickSigninSyncStarter::StartSyncMode start_mode, 345 OneClickSigninSyncStarter::StartSyncMode start_mode,
343 SigninEmailConfirmationDialog::Action action) { 346 SigninEmailConfirmationDialog::Action action) {
344 Browser* browser = chrome::FindLastActiveWithProfile(profile_); 347 Browser* browser = chrome::FindLastActiveWithProfile(profile_);
345 switch (action) { 348 switch (action) {
346 case SigninEmailConfirmationDialog::CREATE_NEW_USER: 349 case SigninEmailConfirmationDialog::CREATE_NEW_USER:
347 content::RecordAction( 350 content::RecordAction(
348 base::UserMetricsAction("Signin_ImportDataPrompt_DontImport")); 351 base::UserMetricsAction("Signin_ImportDataPrompt_DontImport"));
349 if (handler_) { 352 CreateSyncStarter(browser, web_contents, current_url_, GURL(),
350 handler_->SyncStarterCallback( 353 refresh_token, OneClickSigninSyncStarter::NEW_PROFILE,
351 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); 354 start_mode, confirmation_required);
352 }
353 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL,
354 profiles::USER_MANAGER_OPEN_CREATE_USER_PAGE);
355 break; 355 break;
356 case SigninEmailConfirmationDialog::START_SYNC: 356 case SigninEmailConfirmationDialog::START_SYNC:
357 content::RecordAction( 357 content::RecordAction(
358 base::UserMetricsAction("Signin_ImportDataPrompt_ImportData")); 358 base::UserMetricsAction("Signin_ImportDataPrompt_ImportData"));
359 CreateSyncStarter(browser, web_contents, current_url_, GURL(), 359 CreateSyncStarter(browser, web_contents, current_url_, GURL(),
360 refresh_token, start_mode, confirmation_required); 360 refresh_token,
361 OneClickSigninSyncStarter::CURRENT_PROFILE, start_mode,
362 confirmation_required);
361 break; 363 break;
362 case SigninEmailConfirmationDialog::CLOSE: 364 case SigninEmailConfirmationDialog::CLOSE:
363 content::RecordAction( 365 content::RecordAction(
364 base::UserMetricsAction("Signin_ImportDataPrompt_Cancel")); 366 base::UserMetricsAction("Signin_ImportDataPrompt_Cancel"));
365 if (handler_) { 367 if (handler_) {
366 handler_->SyncStarterCallback( 368 handler_->SyncStarterCallback(
367 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); 369 OneClickSigninSyncStarter::SYNC_SETUP_FAILURE);
368 } 370 }
369 break; 371 break;
370 default: 372 default:
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 } 872 }
871 873
872 if (show_account_management) { 874 if (show_account_management) {
873 browser->window()->ShowAvatarBubbleFromAvatarButton( 875 browser->window()->ShowAvatarBubbleFromAvatarButton(
874 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, 876 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
875 signin::ManageAccountsParams(), 877 signin::ManageAccountsParams(),
876 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); 878 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN);
877 } 879 }
878 } 880 }
879 } 881 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698