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

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: rebase Created 4 years, 8 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..1f3b591f7d9bc35b2cebbaf7ba1c7fb3921d7d89 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -390,33 +390,52 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed(
}
}
-void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(
- LoginUIService::SyncConfirmationUIClosedResults results) {
-
+void OneClickSigninSyncStarter::OnSyncConfirmationUIClosed(uint32_t result) {
if (switches::UsePasswordSeparatedSigninFlow()) {
// We didn't run this callback in AccountAddedToCookie so do it now.
if (!sync_setup_completed_callback_.is_null())
sync_setup_completed_callback_.Run(SYNC_SETUP_SUCCESS);
}
- switch (results) {
- case LoginUIService::CONFIGURE_SYNC_FIRST:
- content::RecordAction(
- base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings"));
- chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
- break;
- case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
- content::RecordAction(
- base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
- ProfileSyncService* profile_sync_service = GetProfileSyncService();
- if (profile_sync_service)
- profile_sync_service->SetFirstSetupComplete();
- FinishProfileSyncServiceSetup();
- break;
+ if (result & LoginUIService::CONFIGURE_SYNC_FIRST) {
+ 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_);
}
- case LoginUIService::ABORT_SIGNIN:
- FinishProfileSyncServiceSetup();
- break;
+ } else if (result & LoginUIService::SYNC_WITH_DEFAULT_SETTINGS) {
+ content::RecordAction(
+ base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
+ 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);
+ }
+ } else if (result & LoginUIService::ABORT_SIGNIN) {
+ FinishProfileSyncServiceSetup();
+ } else {
+ NOTREACHED();
+ }
+
+ if (result & LoginUIService::OPEN_ACTIVITY_CONTROLS_URL) {
+ content::RecordAction(
+ base::UserMetricsAction("Signin_Signin_WithActivityControlsCheckbox"));
}
delete this;
@@ -475,13 +494,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 +627,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 +646,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