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

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

Issue 1806353002: Enhanced Sync Confirmation modal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed( 393 void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(
394 LoginUIService::SyncConfirmationUIClosedResults results) { 394 LoginUIService::SyncConfirmationUIClosedResults results) {
395 switch (results) { 395 switch (results) {
396 case LoginUIService::CONFIGURE_SYNC_FIRST: 396 case LoginUIService::CONFIGURE_SYNC_FIRST:
397 content::RecordAction( 397 content::RecordAction(
398 base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings")); 398 base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings"));
399 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); 399 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
400 break; 400 break;
401 case LoginUIService::SYNC_WITH_ACTIVITY_CONTROLS: {
anthonyvd 2016/03/17 20:23:41 This code is probably changing a bit in https://co
Moe 2016/03/18 21:53:40 Acknowledged.
402 content::RecordAction(
403 base::UserMetricsAction("Signin_Signin_WithActivityControls"));
404 StartSync();
405 FinishProfileSyncServiceSetup();
406 // Open the 'Activity controls' section of the privacy settings page.
407 GURL url = GURL(chrome::kGoogleAccountActivityControlsURL);
408 content::OpenURLParams params(url,
409 content::Referrer(),
410 NEW_FOREGROUND_TAB,
411 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
412 false);
413 browser_->OpenURL(params);
414 break;
415 }
401 case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: { 416 case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
402 content::RecordAction( 417 content::RecordAction(
403 base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings")); 418 base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
404 ProfileSyncService* profile_sync_service = GetProfileSyncService(); 419 StartSync();
405 if (profile_sync_service)
406 profile_sync_service->SetFirstSetupComplete();
407 FinishProfileSyncServiceSetup(); 420 FinishProfileSyncServiceSetup();
408 break; 421 break;
409 } 422 }
410 case LoginUIService::ABORT_SIGNIN: 423 case LoginUIService::ABORT_SIGNIN:
411 FinishProfileSyncServiceSetup(); 424 FinishProfileSyncServiceSetup();
412 break; 425 break;
413 } 426 }
414 427
415 delete this; 428 delete this;
416 } 429 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 const GoogleServiceAuthError& error) { 466 const GoogleServiceAuthError& error) {
454 // Regardless of whether the account was successfully added or not, 467 // Regardless of whether the account was successfully added or not,
455 // continue with sync starting. 468 // continue with sync starting.
456 469
457 if (!sync_setup_completed_callback_.is_null()) 470 if (!sync_setup_completed_callback_.is_null())
458 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS); 471 sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS);
459 472
460 switch (start_mode_) { 473 switch (start_mode_) {
461 case SYNC_WITH_DEFAULT_SETTINGS: { 474 case SYNC_WITH_DEFAULT_SETTINGS: {
462 // Just kick off the sync machine, no need to configure it first. 475 // Just kick off the sync machine, no need to configure it first.
463 ProfileSyncService* profile_sync_service = GetProfileSyncService(); 476 StartSync();
464 if (profile_sync_service)
465 profile_sync_service->SetFirstSetupComplete();
466 FinishProfileSyncServiceSetup(); 477 FinishProfileSyncServiceSetup();
467 if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) { 478 if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) {
468 base::string16 message; 479 base::string16 message;
469 if (!profile_sync_service) { 480 if (!GetProfileSyncService()) {
470 // Sync is disabled by policy. 481 // Sync is disabled by policy.
471 message = l10n_util::GetStringUTF16( 482 message = l10n_util::GetStringUTF16(
472 IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE); 483 IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE);
473 } 484 }
474 DisplayFinalConfirmationBubble(message); 485 DisplayFinalConfirmationBubble(message);
475 } 486 }
476 break; 487 break;
477 } 488 }
478 case CONFIRM_SYNC_SETTINGS_FIRST: 489 case CONFIRM_SYNC_SETTINGS_FIRST:
479 if (switches::UsePasswordSeparatedSigninFlow()) { 490 if (switches::UsePasswordSeparatedSigninFlow()) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 603 }
593 } 604 }
594 605
595 ProfileSyncService* OneClickSigninSyncStarter::GetProfileSyncService() { 606 ProfileSyncService* OneClickSigninSyncStarter::GetProfileSyncService() {
596 ProfileSyncService* service = NULL; 607 ProfileSyncService* service = NULL;
597 if (profile_->IsSyncAllowed()) 608 if (profile_->IsSyncAllowed())
598 service = ProfileSyncServiceFactory::GetForProfile(profile_); 609 service = ProfileSyncServiceFactory::GetForProfile(profile_);
599 return service; 610 return service;
600 } 611 }
601 612
613 void OneClickSigninSyncStarter::StartSync() {
anthonyvd 2016/03/17 20:23:41 I'd rename this to SetFirstSetupComplete or someth
Moe 2016/03/18 21:53:40 Done.
614 ProfileSyncService* profile_sync_service = GetProfileSyncService();
615 if (profile_sync_service)
616 profile_sync_service->SetFirstSetupComplete();
617 }
618
602 void OneClickSigninSyncStarter::FinishProfileSyncServiceSetup() { 619 void OneClickSigninSyncStarter::FinishProfileSyncServiceSetup() {
603 ProfileSyncService* service = 620 ProfileSyncService* service =
604 ProfileSyncServiceFactory::GetForProfile(profile_); 621 ProfileSyncServiceFactory::GetForProfile(profile_);
605 if (service) 622 if (service)
606 service->SetSetupInProgress(false); 623 service->SetSetupInProgress(false);
607 } 624 }
608 625
609 void OneClickSigninSyncStarter::ShowSettingsPageInWebContents( 626 void OneClickSigninSyncStarter::ShowSettingsPageInWebContents(
610 content::WebContents* contents, 627 content::WebContents* contents,
611 const std::string& sub_page) { 628 const std::string& sub_page) {
(...skipping 19 matching lines...) Expand all
631 false /* user_gesture */); 648 false /* user_gesture */);
632 } 649 }
633 650
634 void OneClickSigninSyncStarter::LoadContinueUrl() { 651 void OneClickSigninSyncStarter::LoadContinueUrl() {
635 web_contents()->GetController().LoadURL( 652 web_contents()->GetController().LoadURL(
636 continue_url_, 653 continue_url_,
637 content::Referrer(), 654 content::Referrer(),
638 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 655 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
639 std::string()); 656 std::string());
640 } 657 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698