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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage; 6 const OptionsPage = options.OptionsPage;
7 7
8 // Variable to track if a captcha challenge was issued. If this gets set to 8 // Variable to track if a captcha challenge was issued. If this gets set to
9 // true, it stays that way until we are told about successful login from 9 // true, it stays that way until we are told about successful login from
10 // the browser. This means subsequent errors (like invalid password) are 10 // the browser. This means subsequent errors (like invalid password) are
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 /** @inheritDoc */ 87 /** @inheritDoc */
88 didShowPage: function() { 88 didShowPage: function() {
89 chrome.send('SyncSetupAttachHandler'); 89 chrome.send('SyncSetupAttachHandler');
90 }, 90 },
91 91
92 /** @inheritDoc */ 92 /** @inheritDoc */
93 didClosePage: function() { 93 didClosePage: function() {
94 chrome.send('SyncSetupDidClosePage'); 94 chrome.send('SyncSetupDidClosePage');
95 }, 95 },
96 96
97 sendPassphraseAndClose_: function() {
98 var f = $('choose-data-types-form');
99 var result = JSON.stringify({"passphrase": f.passphrase.value});
100 chrome.send('SyncSetupPassphrase', [result]);
101 return false;
102 },
103
104 getEncryptionRadioCheckedValue_: function() { 97 getEncryptionRadioCheckedValue_: function() {
105 var f = $('choose-data-types-form'); 98 var f = $('choose-data-types-form');
106 for (var i = 0; i < f.encrypt.length; ++i) { 99 for (var i = 0; i < f.encrypt.length; ++i) {
107 if (f.encrypt[i].checked) { 100 if (f.encrypt[i].checked) {
108 return f.encrypt[i].value; 101 return f.encrypt[i].value;
109 } 102 }
110 } 103 }
111 104
112 return undefined; 105 return undefined;
113 }, 106 },
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Trying to submit, so hide previous errors. 207 // Trying to submit, so hide previous errors.
215 $('aborted-text').hidden = true; 208 $('aborted-text').hidden = true;
216 $('error-text').hidden = true; 209 $('error-text').hidden = true;
217 210
218 if (this.noDataTypesChecked_()) { 211 if (this.noDataTypesChecked_()) {
219 $('error-text').hidden = false; 212 $('error-text').hidden = false;
220 return; 213 return;
221 } 214 }
222 215
223 var f = $('choose-data-types-form'); 216 var f = $('choose-data-types-form');
224 if (!this.checkPassphraseMatch_())
225 return;
226 217
227 // Don't allow the user to tweak the settings once we send the 218 // Don't allow the user to tweak the settings once we send the
228 // configuration to the backend. 219 // configuration to the backend.
229 this.setInputElementsDisabledState_(true); 220 this.setInputElementsDisabledState_(true);
230 221
231 var syncAll = 222 var syncAll =
232 document.getElementById('sync-select-datatypes').selectedIndex == 0; 223 document.getElementById('sync-select-datatypes').selectedIndex == 0;
233 var usePassphrase = this.getPassphraseRadioCheckedValue_() == 'explicit'; 224 var usePassphrase = this.getPassphraseRadioCheckedValue_() == 'explicit';
234 var encryptAllData = this.getEncryptionRadioCheckedValue_() == 'all'; 225 var encryptAllData = this.getEncryptionRadioCheckedValue_() == 'all';
235 226
227 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.
228 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.
229 // We were prompted for an existing passphrase, use it.
230 custom_passphrase = f.passphrase.value;
231 } else {
232 if (!this.checkPassphraseMatch_()) {
233 return;
234 }
235 custom_passphrase = $('custom-passphrase').value;
236 }
237
238 // If the user has not actually entered a passphrase (for example on
239 // customize when the passphrase box is hidden), we don't attempt to reset
240 // the passphrase.
241 if (custom_passphrase.length == 0) {
242 usePassphrase = false;
243 }
244
236 // These values need to be kept in sync with where they are read in 245 // These values need to be kept in sync with where they are read in
237 // SyncSetupFlow::GetDataTypeChoiceData(). 246 // SyncSetupFlow::GetDataTypeChoiceData().
238 var result = JSON.stringify({ 247 var result = JSON.stringify({
239 "keepEverythingSynced": syncAll, 248 "keepEverythingSynced": syncAll,
240 "syncBookmarks": syncAll || $('bookmarks-checkbox').checked, 249 "syncBookmarks": syncAll || $('bookmarks-checkbox').checked,
241 "syncPreferences": syncAll || $('preferences-checkbox').checked, 250 "syncPreferences": syncAll || $('preferences-checkbox').checked,
242 "syncThemes": syncAll || $('themes-checkbox').checked, 251 "syncThemes": syncAll || $('themes-checkbox').checked,
243 "syncPasswords": syncAll || $('passwords-checkbox').checked, 252 "syncPasswords": syncAll || $('passwords-checkbox').checked,
244 "syncAutofill": syncAll || $('autofill-checkbox').checked, 253 "syncAutofill": syncAll || $('autofill-checkbox').checked,
245 "syncExtensions": syncAll || $('extensions-checkbox').checked, 254 "syncExtensions": syncAll || $('extensions-checkbox').checked,
246 "syncTypedUrls": syncAll || $('typed-urls-checkbox').checked, 255 "syncTypedUrls": syncAll || $('typed-urls-checkbox').checked,
247 "syncApps": syncAll || $('apps-checkbox').checked, 256 "syncApps": syncAll || $('apps-checkbox').checked,
248 "syncSessions": syncAll || $('sessions-checkbox').checked, 257 "syncSessions": syncAll || $('sessions-checkbox').checked,
249 "encryptAllData": encryptAllData, 258 "encryptAllData": encryptAllData,
250 "usePassphrase": usePassphrase, 259 "usePassphrase": usePassphrase,
251 "passphrase": $('custom-passphrase').value 260 "passphrase": custom_passphrase
252 }); 261 });
253 chrome.send('SyncSetupConfigure', [result]); 262 chrome.send('SyncSetupConfigure', [result]);
254 }, 263 },
255 264
256 /** 265 /**
257 * Sets the disabled property of all input elements within the 'Customize 266 * Sets the disabled property of all input elements within the 'Customize
258 * Sync Preferences' screen. This is used to prohibit the user from changing 267 * Sync Preferences' screen. This is used to prohibit the user from changing
259 * the inputs after confirming the customized sync preferences, or resetting 268 * the inputs after confirming the customized sync preferences, or resetting
260 * the state when re-showing the dialog. 269 * the state when re-showing the dialog.
261 * @param disabled True if controls should be set to disabled. 270 * @param disabled True if controls should be set to disabled.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // passphrase radio when switching to the 'Sync everything' page. 448 // passphrase radio when switching to the 'Sync everything' page.
440 if (!this.usePassphrase_) { 449 if (!this.usePassphrase_) {
441 $('google-option').checked = true; 450 $('google-option').checked = true;
442 $('sync-custom-passphrase').hidden = true; 451 $('sync-custom-passphrase').hidden = true;
443 } 452 }
444 453
445 $('confirm-everything-ok').focus(); 454 $('confirm-everything-ok').focus();
446 }, 455 },
447 456
448 /** 457 /**
449 * Reveals the UI for entering a custom passphrase after initial setup. This 458 * Reveals the UI for entering a custom passphrase during initial setup.
450 * may happen if the user forgot to enter the correct (or any) custom 459 * This happens if the user has previously enabled a custom passphrase on a
451 * passphrase during initial setup. 460 * different machine.
452 * @param {Array} args The args that contain the passphrase UI 461 * @param {Array} args The args that contain the passphrase UI
453 * configuration. 462 * configuration.
454 * @private 463 * @private
455 */ 464 */
456 showPassphraseContainer_: function(args) { 465 showPassphraseContainer_: function(args) {
457 $('choose-data-types-form').onsubmit =
458 this.sendPassphraseAndClose_.bind(this);
459 $('sync-custom-passphrase-container').hidden = true; 466 $('sync-custom-passphrase-container').hidden = true;
460 $('sync-existing-passphrase-container').hidden = false; 467 $('sync-existing-passphrase-container').hidden = false;
461 468
462 if (args["passphrase_creation_rejected"]) 469 if (args["passphrase_creation_rejected"])
463 $('passphrase-rejected-body').hidden = false; 470 $('passphrase-rejected-body').hidden = false;
464 else 471 else
465 $('normal-body').hidden = false; 472 $('normal-body').hidden = false;
466 473
467 if (args["passphrase_setting_rejected"]) 474 if (args["passphrase_setting_rejected"])
468 $('incorrect-passphrase').hidden = false; 475 $('incorrect-passphrase').hidden = false;
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 799
793 SyncSetupOverlay.showStopSyncingUI = function() { 800 SyncSetupOverlay.showStopSyncingUI = function() {
794 SyncSetupOverlay.getInstance().showStopSyncingUI_(); 801 SyncSetupOverlay.getInstance().showStopSyncingUI_();
795 }; 802 };
796 803
797 // Export 804 // Export
798 return { 805 return {
799 SyncSetupOverlay: SyncSetupOverlay 806 SyncSetupOverlay: SyncSetupOverlay
800 }; 807 };
801 }); 808 });
OLDNEW
« 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