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

Unified Diff: chrome/browser/resources/options/sync_setup_overlay.js

Issue 7466024: [Sync] Support receiving early passphrase required information in Sync UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed + fix unit test Created 9 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/sync_setup_overlay.js
diff --git a/chrome/browser/resources/options/sync_setup_overlay.js b/chrome/browser/resources/options/sync_setup_overlay.js
index 0af88fa5268e320526ebb5c6f5cc8e595974202e..a5ebbd8f634dcfed0fe5f5887e9e5d6931cecc69 100644
--- a/chrome/browser/resources/options/sync_setup_overlay.js
+++ b/chrome/browser/resources/options/sync_setup_overlay.js
@@ -94,13 +94,6 @@ cr.define('options', function() {
chrome.send('SyncSetupDidClosePage');
},
- sendPassphraseAndClose_: function() {
- var f = $('choose-data-types-form');
- var result = JSON.stringify({"passphrase": f.passphrase.value});
- chrome.send('SyncSetupPassphrase', [result]);
- return false;
- },
-
getEncryptionRadioCheckedValue_: function() {
var f = $('choose-data-types-form');
for (var i = 0; i < f.encrypt.length; ++i) {
@@ -192,7 +185,7 @@ cr.define('options', function() {
var f = $('choose-data-types-form');
if (this.getPassphraseRadioCheckedValue_() != "explicit" ||
- f.option[0].disabled)
+ $('google-option').disabled)
return true;
var customPassphrase = $('custom-passphrase');
@@ -221,6 +214,7 @@ cr.define('options', function() {
}
var f = $('choose-data-types-form');
+ // Must be done before we disable input elements.
if (!this.checkPassphraseMatch_())
return;
@@ -233,6 +227,19 @@ cr.define('options', function() {
var usePassphrase = this.getPassphraseRadioCheckedValue_() == 'explicit';
var encryptAllData = this.getEncryptionRadioCheckedValue_() == 'all';
+ var customPassphrase;
+ // If we were prompted for an existing passphrase, use it.
+ if (!$('sync-existing-passphrase-container').hidden)
+ customPassphrase = f.passphrase.value;
+ else
+ customPassphrase = $('custom-passphrase').value;
+
+ // If the user has not actually entered a passphrase (for example on
+ // customize when the passphrase box is hidden), we don't attempt to reset
+ // the passphrase.
+ if (customPassphrase.length == 0)
+ usePassphrase = false;
+
// These values need to be kept in sync with where they are read in
// SyncSetupFlow::GetDataTypeChoiceData().
var result = JSON.stringify({
@@ -248,7 +255,7 @@ cr.define('options', function() {
"syncSessions": syncAll || $('sessions-checkbox').checked,
"encryptAllData": encryptAllData,
"usePassphrase": usePassphrase,
- "passphrase": $('custom-passphrase').value
+ "passphrase": customPassphrase
});
chrome.send('SyncSetupConfigure', [result]);
},
@@ -446,16 +453,14 @@ cr.define('options', function() {
},
/**
- * 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.
+ * Reveals the UI for entering a custom passphrase during initial setup.
+ * This happens if the user has previously enabled a custom passphrase on a
+ * different machine.
* @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;
« no previous file with comments | « no previous file | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698