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

Unified 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: Addressed comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/sync/one_click_signin_sync_starter.cc
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
index c9020a2e8a3fbccbc47f689d2d7b6ed627ae588b..12ca882becebded804e137b8bbbee1f8c93836fa 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -391,7 +391,7 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed(
}
void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(
- LoginUIService::SyncConfirmationUIClosedResults results) {
+ LoginUIService::SyncConfirmationUIClosedResult result) {
if (switches::UsePasswordSeparatedSigninFlow()) {
// We didn't run this callback in AccountAddedToCookie so do it now.
@@ -399,24 +399,51 @@ void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(
sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS);
}
- switch (results) {
+ switch (result) {
case LoginUIService::CONFIGURE_SYNC_FIRST:
+ case LoginUIService::CONFIGURE_FIRST_OPEN_ACTIVITY_CONTROLS_URL:
content::RecordAction(
base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings"));
chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
+
+ if (result & LoginUIService::OPEN_ACTIVITY_CONTROLS_URL) {
+ // Observer will delete itself
+ new OneClickSigninSyncObserver(
+ web_contents(),
+ profile_,
+ browser_,
+ GURL(chrome::kGoogleAccountActivityControlsURL),
+ continue_url_);
+ }
break;
- case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
+ case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS:
+ case LoginUIService::DEFAULT_SETTINGS_OPEN_ACTIVITY_CONTROLS_URL:
content::RecordAction(
base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
- ProfileSyncService* profile_sync_service = GetProfileSyncService();
- if (profile_sync_service)
- profile_sync_service->SetFirstSetupComplete();
+ SetFirstSetupComplete();
FinishProfileSyncServiceSetup();
+
+ if (result & LoginUIService::OPEN_ACTIVITY_CONTROLS_URL) {
+ // Open the 'Activity controls' section of the privacy settings page.
+ GURL url = GURL(chrome::kGoogleAccountActivityControlsURL);
+ content::OpenURLParams params(url,
+ content::Referrer(),
+ NEW_FOREGROUND_TAB,
+ ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
+ false);
+ browser_->OpenURL(params);
+ }
break;
- }
case LoginUIService::ABORT_SIGNIN:
FinishProfileSyncServiceSetup();
break;
+ case LoginUIService::OPEN_ACTIVITY_CONTROLS_URL:
+ NOTREACHED();
+ }
+
+ if (result & LoginUIService::OPEN_ACTIVITY_CONTROLS_URL) {
+ content::RecordAction(
+ base::UserMetricsAction("Signin_Signin_WithActivityControlsCheckbox"));
}
delete this;
@@ -475,13 +502,11 @@ void OneClickSigninSyncStarter::AccountAddedToCookie(
switch (start_mode_) {
case SYNC_WITH_DEFAULT_SETTINGS: {
// Just kick off the sync machine, no need to configure it first.
- ProfileSyncService* profile_sync_service = GetProfileSyncService();
- if (profile_sync_service)
- profile_sync_service->SetFirstSetupComplete();
+ SetFirstSetupComplete();
FinishProfileSyncServiceSetup();
if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) {
base::string16 message;
- if (!profile_sync_service) {
+ if (!GetProfileSyncService()) {
// Sync is disabled by policy.
message = l10n_util::GetStringUTF16(
IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE);
@@ -610,6 +635,12 @@ ProfileSyncService* OneClickSigninSyncStarter::GetProfileSyncService() {
return service;
}
+void OneClickSigninSyncStarter::SetFirstSetupComplete() {
+ ProfileSyncService* profile_sync_service = GetProfileSyncService();
+ if (profile_sync_service)
+ profile_sync_service->SetFirstSetupComplete();
+}
+
void OneClickSigninSyncStarter::FinishProfileSyncServiceSetup() {
ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_);
@@ -623,7 +654,8 @@ void OneClickSigninSyncStarter::ShowSettingsPageInWebContents(
if (!continue_url_.is_empty()) {
// The observer deletes itself once it's done.
DCHECK(!sub_page.empty());
- new OneClickSigninSyncObserver(contents, continue_url_);
+ new OneClickSigninSyncObserver(contents, profile_, browser_,
+ GURL::EmptyGURL(), continue_url_);
}
GURL url = chrome::GetSettingsUrl(sub_page);

Powered by Google App Engine
This is Rietveld 408576698