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

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: remove old function 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..e847274df25e0a09db97f415825cbca781809000 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) {
@@ -221,8 +214,6 @@ cr.define('options', function() {
}
var f = $('choose-data-types-form');
- if (!this.checkPassphraseMatch_())
- return;
// Don't allow the user to tweak the settings once we send the
// configuration to the backend.
@@ -233,6 +224,24 @@ cr.define('options', function() {
var usePassphrase = this.getPassphraseRadioCheckedValue_() == 'explicit';
var encryptAllData = this.getEncryptionRadioCheckedValue_() == 'all';
+ var custom_passphrase = "";
binji 2011/07/21 01:04:36 nit: javascript variable style is camelCase.
Nicolas Zea 2011/07/21 18:20:49 Done.
+ if ($('sync-existing-passphrase-container').hidden == false) {
binji 2011/07/21 01:04:36 nit: remove == false
Nicolas Zea 2011/07/21 18:20:49 Done.
+ // We were prompted for an existing passphrase, use it.
+ custom_passphrase = f.passphrase.value;
+ } else {
+ if (!this.checkPassphraseMatch_()) {
+ return;
+ }
+ custom_passphrase = $('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 (custom_passphrase.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 +257,7 @@ cr.define('options', function() {
"syncSessions": syncAll || $('sessions-checkbox').checked,
"encryptAllData": encryptAllData,
"usePassphrase": usePassphrase,
- "passphrase": $('custom-passphrase').value
+ "passphrase": custom_passphrase
});
chrome.send('SyncSetupConfigure', [result]);
},
@@ -446,16 +455,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