diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 23:09:07 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-19 23:09:07 +0000 |
commit | 5d0e7c20c442eb9c375b9dfd74c267f0ed90f04c (patch) | |
tree | 686be649da05a1ccb8a0bc0b6d3928e2eac52481 | |
parent | de283bcc1bc9338b40521a7900c46c495225da22 (diff) | |
download | chromium_src-5d0e7c20c442eb9c375b9dfd74c267f0ed90f04c.zip chromium_src-5d0e7c20c442eb9c375b9dfd74c267f0ed90f04c.tar.gz chromium_src-5d0e7c20c442eb9c375b9dfd74c267f0ed90f04c.tar.bz2 |
Sync: Fix a few issues with the refrehsed UI.
BUG=none
TEST=none
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/6878033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82183 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 19 | ||||
-rw-r--r-- | chrome/browser/resources/options/personal_options.html | 4 | ||||
-rw-r--r-- | chrome/browser/resources/options/personal_options.js | 3 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 11 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 7 | ||||
-rw-r--r-- | chrome/browser/sync/resources/configure.html | 50 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc | 27 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.h | 4 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sync/sync_ui_util.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/personal_options_handler.cc | 10 |
12 files changed, 108 insertions, 45 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 79137e2..fddb05c 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -7856,9 +7856,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_PROFILES_CREATE_NEW_PROFILE_OPTION" desc="Create new profile menu item and button title."> Create a new profile... </message> - <message name="IDS_PROFILES_NOT_SET_UP_INFO" desc="The message that appears in the options dialog when the user has not connected a Google Account to their profile."> - You can use a Google Account to sync your bookmarks and other settings and access the Chrome Web Store. - </message> <if expr="not pp_ifdef('use_titlecase')"> <message name="IDS_PROFILES_CONNECT_BUTTON_LABEL" desc="The label that appears on the profile connect button in the options dialog when the user has not connected a Google Account to their profile."> Enable these features... @@ -7912,6 +7909,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_SYNC_CUSTOMIZE_LINK_LABEL" desc="The text to display on the link to customize the sync preferences."> Customize </message> + <message name="IDS_SYNC_USE_DEFAULT_SETTINGS" desc="The text to display on the link to go back to the default sync preferences."> + Use default settings + </message> <!-- SafeBrowsing --> <message name="IDS_SAFE_BROWSING_MALWARE_TITLE" desc="SafeBrowsing Malware HTML title"> @@ -8546,8 +8546,11 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_SYNC_OPTIONS_SELECT_EVERYTHING" desc="The select option that selects all features to be synced."> Everything </message> - <message name="IDS_SYNC_NOT_SET_UP_INFO" desc="The message that appears in the options dialog when sync has not been set up by the user."> - You are not set up to sync your <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> data with your other computers. + <message name="IDS_SYNC_OVERVIEW" desc="The message that appears in the options dialog when sync has not been set up by the user."> + <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> securely syncs your data with your Google account. + </message> + <message name="IDS_SYNC_FURTHER_OVERVIEW" desc="The second message that appears in the options dialog when sync has not been set up by the user."> + Keep everything synced or choose what data to sync from this computer. </message> <if expr="not pp_ifdef('use_titlecase')"> <message name="IDS_SYNC_START_SYNC_BUTTON_LABEL" desc="The label that appears on the sync button in the options dialog when sync has not been set up by the user."> @@ -8838,13 +8841,13 @@ Keep your key file in a safe place. You will need it to create new versions of y </message> <!-- Login dialog strings --> - <message name="IDS_SYNC_MY_BOOKMARKS_LABEL" desc="Title of the sync login dialog."> - Set up sync - </message> <message name="IDS_SYNC_LOGIN_INTRODUCTION" desc="The message to display at the top of the login dialog"> <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> sync makes it easy to share your data (such as bookmarks and preferences) between your computers. <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> synchronizes your data by storing it online with Google when you sign in with your Google Account. </message> + <message name="IDS_SYNC_LOGIN_SIGNIN" desc="The title of the sync setup dialog."> + Sign in with your Google Account + </message> <message name="IDS_SYNC_LOGIN_SIGNIN_PREFIX" desc="The first part of the sentence that is displayed after the login info"> Sign in with your </message> diff --git a/chrome/browser/resources/options/personal_options.html b/chrome/browser/resources/options/personal_options.html index 6823516..e2f148c 100644 --- a/chrome/browser/resources/options/personal_options.html +++ b/chrome/browser/resources/options/personal_options.html @@ -31,6 +31,10 @@ <section id="sync-section"> <h3 i18n-content="syncSection"></h3> <div> + <div id="sync-overview"> + <div i18n-content="syncOverview"></div> + <div i18n-content="syncFurtherOverview"></div> + </div> <div id="sync-status"> <span id="sync-status-text"></span> <button id="sync-action-link" class="link-button"></button> diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js index 9a8823b..7480389 100644 --- a/chrome/browser/resources/options/personal_options.js +++ b/chrome/browser/resources/options/personal_options.js @@ -123,6 +123,9 @@ cr.define('options', function() { }, setSyncStatus_: function(status) { + var statusSet = status != ''; + $('sync-overview').hidden = statusSet; + $('sync-status').hidden = !statusSet; $('sync-status-text').textContent = status; }, diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 937af9f..3abeb75 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -509,7 +509,7 @@ void ProfileSyncService::OnBackendInitialized() { if (!cros_user_.empty()) { if (profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)) { - ShowConfigure(NULL); + ShowConfigure(NULL, true); } else { SetSyncSetupCompleted(); } @@ -703,13 +703,18 @@ void ProfileSyncService::ShowErrorUI(gfx::NativeWindow parent_window) { } -void ProfileSyncService::ShowConfigure(gfx::NativeWindow parent_window) { +void ProfileSyncService::ShowConfigure( + gfx::NativeWindow parent_window, bool sync_everything) { if (WizardIsVisible()) { wizard_.Focus(); return; } wizard_.SetParent(parent_window); - wizard_.Step(SyncSetupWizard::CONFIGURE); + + if (sync_everything) + wizard_.Step(SyncSetupWizard::SYNC_EVERYTHING); + else + wizard_.Step(SyncSetupWizard::CONFIGURE); } void ProfileSyncService::PromptForExistingPassphrase( diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 181cf8e..8ffcd82 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -231,7 +231,12 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // dialog for the error condition (relogin / enter passphrase). virtual void ShowErrorUI(gfx::NativeWindow parent_window); - void ShowConfigure(gfx::NativeWindow parent_window); + // Shows the configure screen of the Sync setup wizard. If |sync_everything| + // is true, shows the corresponding page in the customize screen; otherwise, + // displays the page that gives the user the ability to select which data + // types to sync. + void ShowConfigure(gfx::NativeWindow parent_window, bool sync_everything); + void PromptForExistingPassphrase(gfx::NativeWindow parent_window); void SigninForPassphraseMigration(gfx::NativeWindow parent_window); diff --git a/chrome/browser/sync/resources/configure.html b/chrome/browser/sync/resources/configure.html index 8072452..5677fb3 100644 --- a/chrome/browser/sync/resources/configure.html +++ b/chrome/browser/sync/resources/configure.html @@ -51,7 +51,7 @@ form { margin-top: 10px; } -#customize-link-container { +.action-area-link-container { -webkit-box-flex: 1; } @@ -258,17 +258,42 @@ html[os='mac'] input[type='submit'] { if (args) { setCheckboxesAndErrors(args); - var keepEverythingSynced = args['keepEverythingSynced']; + // Whether to display the 'Sync everything' confirmation screen or the + // customize data types screen. + // TODO(jhawkins): Rename |keepEverythingSynced| to |syncAllDataTypes|. + var syncEverything = args['syncEverything']; + var syncAllDataTypes = args['keepEverythingSynced']; var usePassphrase = args['usePassphrase']; - if (keepEverythingSynced !== true || usePassphrase) { + if (syncEverything == false || syncAllDataTypes == false || + usePassphrase) { showCustomizePage(); } } } - function showCustomizePage() { + function showCustomizePage(chooseDataTypes) { document.getElementById('confirm-sync-preferences').hidden = true; document.getElementById('customize-sync-preferences').hidden = false; + + // If the user clicked on the 'Customize' link on the 'Sync Everything' + // page, he most likely intends to change the data types. Select the 'Choose + // data types' select option in this case. + if (chooseDataTypes) { + document.getElementById('sync-select-datatypes').selectedIndex = 1; + document.getElementById('chooseDataTypesBody').hidden = false; + setDataTypeCheckboxesEnabled(true); + checkAllDataTypeCheckboxes(); + } + } + + function showSyncEverythingPage() { + document.getElementById('confirm-sync-preferences').hidden = false; + document.getElementById('customize-sync-preferences').hidden = true; + + // The default state is to sync everything and to not use a custom + // passphrase. + setCheckboxesToKeepEverythingSynced(true); + document.getElementById("google-option").checked = true; } function setCheckboxesAndErrors(args) { @@ -304,7 +329,8 @@ html[os='mac'] input[type='submit'] { var datatypeSelect = document.getElementById('sync-select-datatypes'); datatypeSelect.selectedIndex = args.keepEverythingSynced ? 0 : 1; - chooseDataTypesBody.hidden = args.keepEverythingSynced; + document.getElementById('chooseDataTypesBody').hidden = + args.keepEverythingSynced; document.getElementById("bookmarksCheckbox").checked = args.syncBookmarks; document.getElementById("preferencesCheckbox").checked = @@ -509,9 +535,9 @@ html[os='mac'] input[type='submit'] { </div> <div> <div class="action-area"> - <div id="customize-link-container"> + <div class="action-area-link-container"> <a id="customize-link" href="#" i18n-content="customizelinklabel" - onclick="showCustomizePage();"></a> + onclick="showCustomizePage(true);"></a> </div> <input id="okButton" type="button" i18n-values="value:syncEverything" onclick="sendConfiguration();"> @@ -527,8 +553,8 @@ html[os='mac'] input[type='submit'] { <div id="sync-configure-content" class="content-area"> <div id="sync-select-container"> <select id="sync-select-datatypes"> - <option i18n-content="keepeverythingsynced" selected></option> - <option i18n-content="choosedatatypes"></option> + <option i18n-content="keepeverythingsynced"></option> + <option i18n-content="choosedatatypes" selected></option> </select> <div id="chooseDataTypesBody" hidden> <div> @@ -621,7 +647,7 @@ html[os='mac'] input[type='submit'] { <div id="sync-custom-passphrase" hidden> <div id="sync-passphrase-message"> <span i18n-content="sectionExplicitMessagePrefix"></span> - <a href="https://google.com/dashboard" target="_blank" + <a href="http://google.com/dashboard" target="_blank" i18n-content="sectionExplicitMessagePostfix"></a> <span>.</span> </div> @@ -640,6 +666,10 @@ html[os='mac'] input[type='submit'] { </div> </div> <div class="action-area"> + <div class="action-area-link-container"> + <a id="use-default-link" href="#" i18n-content="useDefaultSettings" + onclick="showSyncEverythingPage();"></a> + </div> <input id="okButton" type="submit" i18n-values="value:ok" /> <input id="cancelButton" type="button" i18n-values="value:cancel" onclick='chrome.send("DialogClose", [""])' /> diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 795ae69..3e1aecd 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -457,6 +457,7 @@ void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) { OnPassphraseCancel(); // FALL_THROUGH to tell the sync service that we've cancelled during // the configure step. + case SyncSetupWizard::SYNC_EVERYTHING: case SyncSetupWizard::CONFIGURE: case SyncSetupWizard::SETTING_UP: ProfileSyncService::SyncEvent( @@ -479,7 +480,7 @@ void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) { std::wstring SyncSetupFlow::GetDialogTitle() const { return UTF16ToWideHack( - l10n_util::GetStringUTF16(IDS_SYNC_MY_BOOKMARKS_LABEL)); + l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SIGNIN)); } bool SyncSetupFlow::IsDialogModal() const { @@ -530,8 +531,8 @@ void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, DictionaryValue* args) { args->SetString("iframeToShow", "configure"); - // By default start on the data types tab. - args->SetString("initialTab", "data-type"); + // The SYNC_EVERYTHING case will set this to true. + args->SetBoolean("syncEverything", false); args->SetBoolean("keepEverythingSynced", service->profile()->GetPrefs()->GetBoolean(prefs::kKeepEverythingSynced)); @@ -592,17 +593,21 @@ bool SyncSetupFlow::ShouldAdvance(SyncSetupWizard::State state) { current_state_ == SyncSetupWizard::SETTING_UP; case SyncSetupWizard::GAIA_SUCCESS: return current_state_ == SyncSetupWizard::GAIA_LOGIN; + case SyncSetupWizard::SYNC_EVERYTHING: case SyncSetupWizard::CONFIGURE: return current_state_ == SyncSetupWizard::GAIA_SUCCESS; case SyncSetupWizard::ENTER_PASSPHRASE: - return current_state_ == SyncSetupWizard::CONFIGURE || + return current_state_ == SyncSetupWizard::SYNC_EVERYTHING || + current_state_ == SyncSetupWizard::CONFIGURE || current_state_ == SyncSetupWizard::SETTING_UP; case SyncSetupWizard::PASSPHRASE_MIGRATION: return current_state_ == SyncSetupWizard::GAIA_LOGIN; case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR: - return current_state_ == SyncSetupWizard::CONFIGURE; + return current_state_ == SyncSetupWizard::SYNC_EVERYTHING || + current_state_ == SyncSetupWizard::CONFIGURE; case SyncSetupWizard::SETTING_UP: - return current_state_ == SyncSetupWizard::CONFIGURE || + return current_state_ == SyncSetupWizard::SYNC_EVERYTHING || + current_state_ == SyncSetupWizard::CONFIGURE || current_state_ == SyncSetupWizard::ENTER_PASSPHRASE || current_state_ == SyncSetupWizard::PASSPHRASE_MIGRATION; case SyncSetupWizard::FATAL_ERROR: @@ -636,12 +641,18 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) { flow_handler_->ShowGaiaSuccessAndClose(); break; } - advance_state = SyncSetupWizard::CONFIGURE; + advance_state = SyncSetupWizard::SYNC_EVERYTHING; // Fall through. + case SyncSetupWizard::SYNC_EVERYTHING: { + DictionaryValue args; + SyncSetupFlow::GetArgsForConfigure(service_, &args); + args.SetBoolean("syncEverything", true); + flow_handler_->ShowConfigure(args); + break; + } case SyncSetupWizard::CONFIGURE: { DictionaryValue args; SyncSetupFlow::GetArgsForConfigure(service_, &args); - args.SetString("initialTab", "data-type"); flow_handler_->ShowConfigure(args); break; } diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index 6622a1d..f8376d8 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -187,6 +187,7 @@ void SyncResourcesSource::StartDataRequest(const std::string& path_raw, // Stuff for the footer. AddString(dict, "customizelinklabel", IDS_SYNC_CUSTOMIZE_LINK_LABEL); + AddString(dict, "useDefaultSettings", IDS_SYNC_USE_DEFAULT_SETTINGS); AddString(dict, "ok", IDS_OK); AddString(dict, "cancel", IDS_CANCEL); } else if (path_raw == kSyncPassphrasePath) { @@ -346,6 +347,7 @@ SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun( if (start_state == GAIA_LOGIN) { result = GAIA_SUCCESS; } else if (start_state == ENTER_PASSPHRASE || + start_state == SYNC_EVERYTHING || start_state == CONFIGURE || start_state == PASSPHRASE_MIGRATION) { result = DONE; diff --git a/chrome/browser/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h index ce08266..521ef89 100644 --- a/chrome/browser/sync/sync_setup_wizard.h +++ b/chrome/browser/sync/sync_setup_wizard.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,6 +21,8 @@ class SyncSetupWizard { // A login attempt succeeded. This will wait for an explicit transition // (via Step) to the next state. GAIA_SUCCESS, + // Show the screen that confirms everything will be synced. + SYNC_EVERYTHING, // Show the screen that lets you configure sync. // There are two tabs: // Data Types -- diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index 24cae05..a9dd9db 100644 --- a/chrome/browser/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -295,8 +295,8 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) { EXPECT_TRUE(wizard_->IsVisible()); EXPECT_FALSE(test_window_->TestAndResetWasShowHTMLDialogCalled()); // In a non-discrete run, GAIA_SUCCESS immediately transitions you to - // CONFIGURE. - EXPECT_EQ(SyncSetupWizard::CONFIGURE, + // SYNC_EVERYTHING. + EXPECT_EQ(SyncSetupWizard::SYNC_EVERYTHING, test_window_->flow()->current_state_); // That's all we're testing here, just move on to DONE. We'll test the @@ -424,7 +424,7 @@ TEST_F(SyncSetupWizardTest, InvalidTransitions) { test_window_->flow()->current_state_); wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); - EXPECT_EQ(SyncSetupWizard::CONFIGURE, + EXPECT_EQ(SyncSetupWizard::SYNC_EVERYTHING, test_window_->flow()->current_state_); wizard_->Step(SyncSetupWizard::FATAL_ERROR); diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index ac78499..5d5bb84 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc @@ -174,16 +174,6 @@ MessageType GetStatusInfo(ProfileSyncService* service, if (status_label) { status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR)); } - } else { - if (status_label) { - const CommandLine& browser_command_line = - *CommandLine::ForCurrentProcess(); - status_label->assign( - browser_command_line.HasSwitch(switches::kMultiProfiles) ? - l10n_util::GetStringUTF16(IDS_PROFILES_NOT_SET_UP_INFO) : - l10n_util::GetStringFUTF16(IDS_SYNC_NOT_SET_UP_INFO, - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); - } } } return result_type; diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc index 820ee74..c23efdb 100644 --- a/chrome/browser/ui/webui/options/personal_options_handler.cc +++ b/chrome/browser/ui/webui/options/personal_options_handler.cc @@ -74,6 +74,14 @@ void PersonalOptionsHandler::GetLocalizedValues( RegisterTitle(localized_strings, "personalPage", IDS_OPTIONS_CONTENT_TAB_LABEL); + + localized_strings->SetString( + "syncOverview", + l10n_util::GetStringFUTF16(IDS_SYNC_OVERVIEW, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); + localized_strings->SetString( + "syncFurtherOverview", + l10n_util::GetStringUTF16(IDS_SYNC_FURTHER_OVERVIEW)); localized_strings->SetString("syncSection", multiprofile_ ? l10n_util::GetStringUTF16(IDS_PROFILES_OPTIONS_GROUP_NAME) : @@ -409,7 +417,7 @@ void PersonalOptionsHandler::ShowSyncLoginDialog(const ListValue* args) { void PersonalOptionsHandler::ShowCustomizeSyncDialog(const ListValue* args) { ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService(); DCHECK(service); - service->ShowConfigure(NULL); + service->ShowConfigure(NULL, false); } void PersonalOptionsHandler::ThemesReset(const ListValue* args) { |