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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 1806193003: Under the tab-modal signin flow, always show the Confirmation dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix spelling Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync/one_click_signin_sync_starter.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 else if (start_mode_ == CONFIRM_SYNC_SETTINGS_FIRST) 385 else if (start_mode_ == CONFIRM_SYNC_SETTINGS_FIRST)
386 start_mode_ = SYNC_WITH_DEFAULT_SETTINGS; 386 start_mode_ = SYNC_WITH_DEFAULT_SETTINGS;
387 387
388 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); 388 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
389 signin->CompletePendingSignin(); 389 signin->CompletePendingSignin();
390 } 390 }
391 } 391 }
392 392
393 void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed( 393 void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(
394 LoginUIService::SyncConfirmationUIClosedResults results) { 394 LoginUIService::SyncConfirmationUIClosedResults results) {
395
396 if (switches::UsePasswordSeparatedSigninFlow()) {
397 // We didn't run this callback in AccountAddedToCookie so do it now.
398 if (!sync_setup_completed_callback_.is_null())
399 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS);
400 }
401
395 switch (results) { 402 switch (results) {
396 case LoginUIService::CONFIGURE_SYNC_FIRST: 403 case LoginUIService::CONFIGURE_SYNC_FIRST:
397 content::RecordAction( 404 content::RecordAction(
398 base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings")); 405 base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings"));
399 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); 406 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
400 break; 407 break;
401 case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: { 408 case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
402 content::RecordAction( 409 content::RecordAction(
403 base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings")); 410 base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
404 ProfileSyncService* profile_sync_service = GetProfileSyncService(); 411 ProfileSyncService* profile_sync_service = GetProfileSyncService();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 signin_metrics::LogSigninReason( 454 signin_metrics::LogSigninReason(
448 signin::GetSigninReasonForPromoURL(current_url_)); 455 signin::GetSigninReasonForPromoURL(current_url_));
449 content::RecordAction(base::UserMetricsAction("Signin_Signin_Succeed")); 456 content::RecordAction(base::UserMetricsAction("Signin_Signin_Succeed"));
450 } 457 }
451 458
452 void OneClickSigninSyncStarter::AccountAddedToCookie( 459 void OneClickSigninSyncStarter::AccountAddedToCookie(
453 const GoogleServiceAuthError& error) { 460 const GoogleServiceAuthError& error) {
454 // Regardless of whether the account was successfully added or not, 461 // Regardless of whether the account was successfully added or not,
455 // continue with sync starting. 462 // continue with sync starting.
456 463
464 if (switches::UsePasswordSeparatedSigninFlow()) {
465 // Under the new signin flow, the sync confirmation dialog should always be
466 // shown regardless of |start_mode_|. |sync_setup_completed_callback_| will
467 // be run after the modal is closed.
468 DisplayModalSyncConfirmationWindow();
469 return;
470 }
471
457 if (!sync_setup_completed_callback_.is_null()) 472 if (!sync_setup_completed_callback_.is_null())
458 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS); 473 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS);
459 474
460 switch (start_mode_) { 475 switch (start_mode_) {
461 case SYNC_WITH_DEFAULT_SETTINGS: { 476 case SYNC_WITH_DEFAULT_SETTINGS: {
462 // Just kick off the sync machine, no need to configure it first. 477 // Just kick off the sync machine, no need to configure it first.
463 ProfileSyncService* profile_sync_service = GetProfileSyncService(); 478 ProfileSyncService* profile_sync_service = GetProfileSyncService();
464 if (profile_sync_service) 479 if (profile_sync_service)
465 profile_sync_service->SetFirstSetupComplete(); 480 profile_sync_service->SetFirstSetupComplete();
466 FinishProfileSyncServiceSetup(); 481 FinishProfileSyncServiceSetup();
467 if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) { 482 if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) {
468 base::string16 message; 483 base::string16 message;
469 if (!profile_sync_service) { 484 if (!profile_sync_service) {
470 // Sync is disabled by policy. 485 // Sync is disabled by policy.
471 message = l10n_util::GetStringUTF16( 486 message = l10n_util::GetStringUTF16(
472 IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE); 487 IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE);
473 } 488 }
474 DisplayFinalConfirmationBubble(message); 489 DisplayFinalConfirmationBubble(message);
475 } 490 }
476 break; 491 break;
477 } 492 }
478 case CONFIRM_SYNC_SETTINGS_FIRST: 493 case CONFIRM_SYNC_SETTINGS_FIRST:
479 if (switches::UsePasswordSeparatedSigninFlow()) { 494 // Blocks sync until the sync settings confirmation UI is closed.
480 DisplayModalSyncConfirmationWindow(); 495 DisplayFinalConfirmationBubble(base::string16());
481 } else {
482 // Blocks sync until the sync settings confirmation UI is closed.
483 DisplayFinalConfirmationBubble(base::string16());
484 }
485 return; 496 return;
486 case CONFIGURE_SYNC_FIRST: 497 case CONFIGURE_SYNC_FIRST:
487 ShowSettingsPage(true); // Show sync config UI. 498 ShowSettingsPage(true); // Show sync config UI.
488 break; 499 break;
489 case SHOW_SETTINGS_WITHOUT_CONFIGURE: 500 case SHOW_SETTINGS_WITHOUT_CONFIGURE:
490 ShowSettingsPage(false); // Don't show sync config UI. 501 ShowSettingsPage(false); // Don't show sync config UI.
491 break; 502 break;
492 case UNDO_SYNC: 503 case UNDO_SYNC:
493 NOTREACHED(); 504 NOTREACHED();
494 } 505 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 false /* user_gesture */); 642 false /* user_gesture */);
632 } 643 }
633 644
634 void OneClickSigninSyncStarter::LoadContinueUrl() { 645 void OneClickSigninSyncStarter::LoadContinueUrl() {
635 web_contents()->GetController().LoadURL( 646 web_contents()->GetController().LoadURL(
636 continue_url_, 647 continue_url_,
637 content::Referrer(), 648 content::Referrer(),
638 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 649 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
639 std::string()); 650 std::string());
640 } 651 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698