diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-01 18:49:44 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-01 18:49:44 +0000 |
commit | b29974139602e00760b943340523b45b3296bb8f (patch) | |
tree | 050d942c2078306f992761bbfdab22cff552678a /chrome | |
parent | 8a7299801481da83df1ecf830200b84b192a6876 (diff) | |
download | chromium_src-b29974139602e00760b943340523b45b3296bb8f.zip chromium_src-b29974139602e00760b943340523b45b3296bb8f.tar.gz chromium_src-b29974139602e00760b943340523b45b3296bb8f.tar.bz2 |
Sync: Remove the passphrase page and inline passphrase input in the Customize screen.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7076025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 5 | ||||
-rw-r--r-- | chrome/browser/resources/options/sync_setup_overlay.css | 15 | ||||
-rw-r--r-- | chrome/browser/resources/options/sync_setup_overlay.html | 59 | ||||
-rw-r--r-- | chrome/browser/resources/options/sync_setup_overlay.js | 121 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/sync_setup_handler.cc | 7 |
6 files changed, 94 insertions, 115 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 1851bc1..e16852e 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -9086,9 +9086,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_SYNC_PASSPHRASE_WARNING" desc="Warning message about using a passphrase for sync."> You are currently using a passphrase. If you have forgotten your passphrase, you can reset sync to clear your data from Google's servers using the Google Dashboard. </message> - <message name="IDS_SYNC_CLEAR_DATA_LINK" desc="Link to the Google Dashboard."> - Visit the Google Dashboard - </message> <!-- Passphrase dialog strings --> <if expr="not pp_ifdef('use_titlecase')"> @@ -9123,7 +9120,7 @@ Keep your key file in a safe place. You will need it to create new versions of y The passphrase you entered is incorrect. </message> <message name="IDS_SYNC_PASSPHRASE_RECOVER" desc="Message about how to recover from a lost passphrase."> - If you've forgotten your passphrase, you'll need to stop sync via the Google Dashboard. + If you've forgotten your passphrase, stop and reset Sync via <ph name="BEGIN_LINK"><a href="$2"></ph>Google Dashboard<ph name="END_LINK"></a></ph>. </message> <message name="IDS_SYNC_PASSPHRASE_CANCEL_WARNING_HEADER" desc="Header for the passphrase cancel warning. Should be phrased as a yes-or-no question."> diff --git a/chrome/browser/resources/options/sync_setup_overlay.css b/chrome/browser/resources/options/sync_setup_overlay.css index 39cd67e..ee3cc29 100644 --- a/chrome/browser/resources/options/sync_setup_overlay.css +++ b/chrome/browser/resources/options/sync_setup_overlay.css @@ -32,6 +32,12 @@ margin: 10px 0; } +#sync-existing-passphrase-container { + background: #fff29e; + border: 1px solid #d4cdad; + padding: 10px; +} + #sync-select-container { margin-bottom: 10px; } @@ -113,8 +119,8 @@ } #passphrase-input { - margin-top: 20px; - margin-bottom: 20px; + margin-top: 5px; + margin-bottom: 5px; } #incorrect-passphrase { @@ -305,11 +311,6 @@ html[os='mac'] #sync-setup-configure { margin-top: 5px; } -.sync-instructions-start-hidden { - margin-top: 10px; - display: none; -} - .sync-error-show { display: block; width: 80%; diff --git a/chrome/browser/resources/options/sync_setup_overlay.html b/chrome/browser/resources/options/sync_setup_overlay.html index 33d25ec..a04e530 100644 --- a/chrome/browser/resources/options/sync_setup_overlay.html +++ b/chrome/browser/resources/options/sync_setup_overlay.html @@ -310,7 +310,8 @@ </div> <hr> <h4 i18n-content="passphraseSectionTitle"></h4> - <div class="sync-customize-section-container"> + <div id="sync-custom-passphrase-container" + class="sync-customize-section-container"> <div id="passphrase-encryption-message" i18n-content="passphraseEncryptionMessage"></div> <div> @@ -347,6 +348,24 @@ i18n-content="mismatchErrorMessage"></div> </div> </div> + <div id="sync-existing-passphrase-container" hidden> + <div id="enter-passphrase"> + <div id="normal-body" i18n-content="enterPassphraseBody" hidden> + </div> + <div id="passphrase-rejected-body" + i18n-content="enterOtherPassphraseBody" hidden> + </div> + </div> + <div id="passphrase-input"> + <input id="passphrase" name="passphrase" type="password" + i18n-values="placeholder:passphraseLabel"> + <div id="incorrect-passphrase" class="error" + i18n-content="incorrectPassphrase" hidden> + </div> + </div> + <div id="sync-passphrase-warning"> + </div> + </div> </div> <div class="action-area"> <div class="action-area-link-container"> @@ -361,42 +380,4 @@ </form> </div> </div> - <div id="sync-setup-passphrase" hidden> - <h1 i18n-content="enterPassphraseTitle"></h1> - <div class="content-area"> - <form id="passphrase-form"> - <div id="enter-passphrase"> - <div id="normal-body" class="sync-instructions-start-hidden" - i18n-content="enterPassphraseBody"> - </div> - <div id="passphrase-rejected-body" - class="sync-instructions-start-hidden" - i18n-content="enterOtherPassphraseBody"> - </div> - </div> - <div id="passphrase-input"> - <label for="passphrase" i18n-content="passphraseLabel"></label> - <input id="passphrase" name="passphrase" type="password"> - <div id="incorrect-passphrase" class="error" - i18n-content="incorrectPassphrase"> - </div> - </div> - <span id="sync-passphrase-warning" i18n-content="passphraseRecover"> - </span> <a href="http://google.com/dashboard" target="_blank" - i18n-content="clearDataLink"></a> - <div id="cancel-warning-box" class="overlay-warning" hidden> - <div id="cancel-warning-header" i18n-content="cancelWarningHeader"> - </div> - <div id="cancel-warning" i18n-content="cancelWarning"></div> - <input id="cancel-yes-button" type="submit" i18n-values="value:yes"> - <input id="cancel-no-button" type="submit" i18n-values="value:no"> - </div> - </form> - </div> - <div class="action-area"> - <div id="passphrase-throbber" class="throbber"></div> - <input id="passphrase-ok" type="submit" i18n-values="value:ok"> - <input id="passphrase-cancel" type="button" i18n-values="value:cancel"> - </div> - </div> </div> diff --git a/chrome/browser/resources/options/sync_setup_overlay.js b/chrome/browser/resources/options/sync_setup_overlay.js index 0b649b8..766d037 100644 --- a/chrome/browser/resources/options/sync_setup_overlay.js +++ b/chrome/browser/resources/options/sync_setup_overlay.js @@ -70,7 +70,7 @@ cr.define('options', function() { self.closeOverlay_(); }; $('customize-link').onclick = function() { - self.showCustomizePage_(true); + self.showCustomizePage_(null, true); }; $('confirm-everything-ok').onclick = function() { self.sendConfiguration_(); @@ -78,22 +78,6 @@ cr.define('options', function() { $('use-default-link').onclick = function() { self.showSyncEverythingPage_(); }; - $('cancel-no-button').onclick = function() { - self.hideCancelWarning_(); - return false; - }; - $('cancel-yes-button').onclick = function() { - chrome.send('SyncSetupPassphraseCancel', ['']); - return false; - }; - $('passphrase-form').onsubmit = $('passphrase-ok').onclick = function() { - self.sendPassphraseAndClose_(); - return false; - }; - $('passphrase-cancel').onclick = function() { - self.showCancelWarning_(); - return false; - }; }, showOverlay_: function() { @@ -114,17 +98,11 @@ cr.define('options', function() { chrome.send('SyncSetupDidClosePage'); }, - showCancelWarning_: function() { - $('cancel-warning-box').hidden = false; - $('passphrase-ok').disabled = true; - $('passphrase-cancel').disabled = true; - $('cancel-no-button').focus(); - }, - sendPassphraseAndClose_: function() { - var f = $('passphrase-form'); + var f = $('choose-data-types-form'); var result = JSON.stringify({"passphrase": f.passphrase.value}); chrome.send('SyncSetupPassphrase', [result]); + return false; }, getEncryptionRadioCheckedValue_: function() { @@ -236,12 +214,6 @@ cr.define('options', function() { return true; }, - hideCancelWarning_: function() { - $('cancel-warning-box').hidden = true; - $('passphrase-ok').disabled = false; - $('passphrase-cancel').disabled = false; - }, - sendConfiguration_: function() { // Trying to submit, so hide previous errors. $('aborted-text').className = "sync-error-hide"; @@ -402,6 +374,8 @@ cr.define('options', function() { $('sync-setup-configure').hidden = false; + this.clearPassphraseInputs_(); + if (args) { if (!args['encryptionEnabled']) $('customize-sync-encryption').hidden = true; @@ -409,21 +383,30 @@ cr.define('options', function() { // Whether to display the 'Sync everything' confirmation page or the // customize data types page. - var showSyncEverythingPage = args['showSyncEverythingPage']; var keepEverythingSynced = args['keepEverythingSynced']; this.usePassphrase_ = args['usePassphrase']; - if (showSyncEverythingPage == false || - keepEverythingSynced == false || this.usePassphrase_) { - this.showCustomizePage_(keepEverythingSynced); + if (args['showSyncEverythingPage'] == false || this.usePassphrase_ || + keepEverythingSynced == false || args['show_passphrase']) { + this.showCustomizePage_(args, keepEverythingSynced); } else { this.showSyncEverythingPage_(); } } }, + /** + * Clears the value of the custom passphrase inputs. + * @private + */ + clearPassphraseInputs_: function() { + $('custom-passphrase').value = ''; + $('confirm-passphrase').value = ''; + }, + showSyncEverythingPage_: function() { $('confirm-sync-preferences').hidden = false; $('customize-sync-preferences').hidden = true; + this.clearPassphraseInputs_(); // Reset the selection to 'Sync everything'. $('sync-select-datatypes').selectedIndex = 0; @@ -441,17 +424,51 @@ cr.define('options', function() { $('confirm-everything-ok').focus(); }, - showCustomizePage_: function(syncEverything) { - document.getElementById('confirm-sync-preferences').hidden = true; - document.getElementById('customize-sync-preferences').hidden = false; + /** + * Reveals the UI for entering a custom passphrase after initial setup. This + * may happen if the user forgot to enter the correct (or any) custom + * passphrase during initial setup. + * @param {Array} args The args that contain the passphrase UI + * configuration. + * @private + */ + showPassphraseContainer_: function(args) { + $('choose-data-types-form').onsubmit = + this.sendPassphraseAndClose_.bind(this); + $('sync-custom-passphrase-container').hidden = true; + $('sync-existing-passphrase-container').hidden = false; + + if (args["passphrase_creation_rejected"]) + $('passphrase-rejected-body').hidden = false; + else + $('normal-body').hidden = false; + + if (args["passphrase_setting_rejected"]) + $('incorrect-passphrase').hidden = false; + + $('sync-passphrase-warning').innerHTML = + localStrings.getString('passphraseRecover'); + + $('passphrase').focus(); + }, + + showCustomizePage_: function(args, syncEverything) { + $('confirm-sync-preferences').hidden = true; + $('customize-sync-preferences').hidden = false; + + $('sync-custom-passphrase-container').hidden = false; + $('sync-existing-passphrase-container').hidden = true; // If the user has selected the 'Customize' page on initial set up, it's - // likely he intends to change the data types. Select the + // likely he intends to change the data types. Select the // 'Choose data types' option in this case. var index = syncEverything ? 0 : 1; document.getElementById('sync-select-datatypes').selectedIndex = index; this.setDataTypeCheckboxesEnabled_(!syncEverything); $('choose-datatypes-ok').focus(); + + if (args && args['show_passphrase']) + this.showPassphraseContainer_(args); }, attach_: function() { @@ -475,10 +492,8 @@ cr.define('options', function() { if (page == 'login') this.showGaiaLogin_(args); - else if (page == 'configure') + else if (page == 'configure' || page == 'passphrase') this.showConfigure_(args); - else if (page == 'passphrase') - this.showPassphrase_(args); if (page == 'done') this.closeOverlay_(); @@ -492,26 +507,6 @@ cr.define('options', function() { throbbers[i].style.visibility = visible ? "visible" : "hidden"; }, - showPassphrase_: function(args) { - $('sync-setup-passphrase').hidden = false; - - $('passphrase-rejected-body').style.display = "none"; - $('normal-body').style.display = "none"; - $('incorrect-passphrase').style.display = "none"; - - if (args["passphrase_creation_rejected"]) { - $('passphrase-rejected-body').style.display = "block"; - } else { - $('normal-body').style.display = "block"; - } - - if (args["passphrase_setting_rejected"]) { - $('incorrect-passphrase').style.display = "block"; - } - - $('passphrase').focus(); - }, - setElementDisplay_: function(id, display) { var d = document.getElementById(id); if (d) @@ -681,7 +676,7 @@ cr.define('options', function() { chrome.send('SyncSetupSubmitAuth', [result]); }, - showGaiaSuccessAndClose_: function() { + showSuccessAndClose_: function() { $('sign-in').value = localStrings.getString('loginSuccess'); setTimeout(this.closeOverlay_, 1600); }, diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 3ac1616..034edf4 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -151,6 +151,7 @@ void SyncSetupFlow::GetArgsForEnterPassphrase( bool tried_creating_explicit_passphrase, bool tried_setting_explicit_passphrase, DictionaryValue* args) { + args->SetBoolean("show_passphrase", true); args->SetBoolean("passphrase_creation_rejected", tried_creating_explicit_passphrase); args->SetBoolean("passphrase_setting_rejected", @@ -350,6 +351,7 @@ void SyncSetupFlow::ActivateState(SyncSetupWizard::State state) { } case SyncSetupWizard::ENTER_PASSPHRASE: { DictionaryValue args; + SyncSetupFlow::GetArgsForConfigure(service_, &args); SyncSetupFlow::GetArgsForEnterPassphrase( tried_creating_explicit_passphrase_, tried_setting_explicit_passphrase_, diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/options/sync_setup_handler.cc index 84cb58e6..4193c29 100644 --- a/chrome/browser/ui/webui/options/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc @@ -11,6 +11,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/sync_setup_flow.h" +#include "chrome/common/url_constants.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -182,6 +183,10 @@ void SyncSetupHandler::GetLocalizedValues(DictionaryValue* localized_strings) { "passphraseEncryptionMessage", GetStringFUTF16(IDS_SYNC_PASSPHRASE_ENCRYPTION_MESSAGE, GetStringUTF16(IDS_PRODUCT_NAME))); + localized_strings->SetString( + "passphraseRecover", + GetStringFUTF16(IDS_SYNC_PASSPHRASE_RECOVER, + ASCIIToUTF16(chrome::kSyncGoogleDashboardURL))); static OptionsStringResource resources[] = { { "syncSetupOverlayTitle", IDS_SYNC_SETUP_TITLE }, @@ -227,7 +232,6 @@ void SyncSetupHandler::GetLocalizedValues(DictionaryValue* localized_strings) { { "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR }, { "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR }, { "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING }, - { "clearDataLink", IDS_SYNC_CLEAR_DATA_LINK }, { "customizeLinkLabel", IDS_SYNC_CUSTOMIZE_LINK_LABEL }, { "confirmSyncPreferences", IDS_SYNC_CONFIRM_SYNC_PREFERENCES }, { "syncEverything", IDS_SYNC_SYNC_EVERYTHING }, @@ -239,7 +243,6 @@ void SyncSetupHandler::GetLocalizedValues(DictionaryValue* localized_strings) { { "enterOtherPassphraseBody", IDS_SYNC_ENTER_OTHER_PASSPHRASE_BODY }, { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL }, { "incorrectPassphrase", IDS_SYNC_INCORRECT_PASSPHRASE }, - { "passphraseRecover", IDS_SYNC_PASSPHRASE_RECOVER }, { "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING }, { "cancelWarningHeader", IDS_SYNC_PASSPHRASE_CANCEL_WARNING_HEADER }, { "cancelWarning", IDS_SYNC_PASSPHRASE_CANCEL_WARNING }, |