Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 customPassphrase = $('custom-passphrase').value; | 237 customPassphrase = $('custom-passphrase').value; |
| 238 usePassphrase = true; | 238 usePassphrase = true; |
| 239 } else { | 239 } else { |
| 240 // The user is not setting a custom passphrase. | 240 // The user is not setting a custom passphrase. |
| 241 usePassphrase = false; | 241 usePassphrase = false; |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Don't allow the user to tweak the settings once we send the | 244 // Don't allow the user to tweak the settings once we send the |
| 245 // configuration to the backend. | 245 // configuration to the backend. |
| 246 this.setInputElementsDisabledState_(true); | 246 this.setInputElementsDisabledState_(true); |
| 247 var self = this; | |
| 248 this.animateDisableLink_($('use-default-link'), true, function() { | |
|
James Hawkins
2011/07/31 23:50:53
No need to specify this callback function since yo
Nicolas Zea
2011/08/01 17:09:59
Done.
| |
| 249 self.showSyncEverythingPage_(); | |
| 250 }); | |
| 247 | 251 |
| 248 // These values need to be kept in sync with where they are read in | 252 // These values need to be kept in sync with where they are read in |
| 249 // SyncSetupFlow::GetDataTypeChoiceData(). | 253 // SyncSetupFlow::GetDataTypeChoiceData(). |
| 250 var result = JSON.stringify({ | 254 var result = JSON.stringify({ |
| 251 "keepEverythingSynced": syncAll, | 255 "keepEverythingSynced": syncAll, |
| 252 "syncBookmarks": syncAll || $('bookmarks-checkbox').checked, | 256 "syncBookmarks": syncAll || $('bookmarks-checkbox').checked, |
| 253 "syncPreferences": syncAll || $('preferences-checkbox').checked, | 257 "syncPreferences": syncAll || $('preferences-checkbox').checked, |
| 254 "syncThemes": syncAll || $('themes-checkbox').checked, | 258 "syncThemes": syncAll || $('themes-checkbox').checked, |
| 255 "syncPasswords": syncAll || $('passwords-checkbox').checked, | 259 "syncPasswords": syncAll || $('passwords-checkbox').checked, |
| 256 "syncAutofill": syncAll || $('autofill-checkbox').checked, | 260 "syncAutofill": syncAll || $('autofill-checkbox').checked, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 277 var configureElements = | 281 var configureElements = |
| 278 $('customize-sync-preferences').querySelectorAll('input'); | 282 $('customize-sync-preferences').querySelectorAll('input'); |
| 279 for (var i = 0; i < configureElements.length; i++) | 283 for (var i = 0; i < configureElements.length; i++) |
| 280 configureElements[i].disabled = disabled; | 284 configureElements[i].disabled = disabled; |
| 281 $('sync-select-datatypes').disabled = disabled; | 285 $('sync-select-datatypes').disabled = disabled; |
| 282 | 286 |
| 283 var self = this; | 287 var self = this; |
| 284 this.animateDisableLink_($('customize-link'), disabled, function() { | 288 this.animateDisableLink_($('customize-link'), disabled, function() { |
| 285 self.showCustomizePage_(null, true); | 289 self.showCustomizePage_(null, true); |
| 286 }); | 290 }); |
| 287 | |
| 288 this.animateDisableLink_($('use-default-link'), disabled, function() { | |
| 289 self.showSyncEverythingPage_(); | |
| 290 }); | |
| 291 }, | 291 }, |
| 292 | 292 |
| 293 /** | 293 /** |
| 294 * Animate a link being enabled/disabled. The link is hidden by animating | 294 * Animate a link being enabled/disabled. The link is hidden by animating |
| 295 * its opacity, but to ensure the user doesn't click it during that time, | 295 * its opacity, but to ensure the user doesn't click it during that time, |
| 296 * its onclick handler is changed to null as well. | 296 * its onclick handler is changed to null as well. |
| 297 * @param elt The anchor element to enable/disable. | 297 * @param elt The anchor element to enable/disable. |
| 298 * @param disabled True if the link should be disabled. | 298 * @param disabled True if the link should be disabled. |
| 299 * @param enabledFunction The onclick handler when the link is enabled. | 299 * @param enabledFunction The onclick handler when the link is enabled. |
| 300 * @private | 300 * @private |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 | 459 |
| 460 /** | 460 /** |
| 461 * Reveals the UI for entering a custom passphrase during initial setup. | 461 * Reveals the UI for entering a custom passphrase during initial setup. |
| 462 * This happens if the user has previously enabled a custom passphrase on a | 462 * This happens if the user has previously enabled a custom passphrase on a |
| 463 * different machine. | 463 * different machine. |
| 464 * @param {Array} args The args that contain the passphrase UI | 464 * @param {Array} args The args that contain the passphrase UI |
| 465 * configuration. | 465 * configuration. |
| 466 * @private | 466 * @private |
| 467 */ | 467 */ |
| 468 showPassphraseContainer_: function(args) { | 468 showPassphraseContainer_: function(args) { |
| 469 // Once we require a passphrase, we prevent the user from returning to | |
| 470 // the Sync Everything pane. | |
| 471 $('use-default-link').hidden = true; | |
| 469 $('sync-custom-passphrase-container').hidden = true; | 472 $('sync-custom-passphrase-container').hidden = true; |
| 470 $('sync-existing-passphrase-container').hidden = false; | 473 $('sync-existing-passphrase-container').hidden = false; |
| 471 | 474 |
| 472 if (args["passphrase_creation_rejected"]) | 475 if (args["passphrase_creation_rejected"]) |
| 473 $('passphrase-rejected-body').hidden = false; | 476 $('passphrase-rejected-body').hidden = false; |
| 474 else | 477 else |
| 475 $('normal-body').hidden = false; | 478 $('normal-body').hidden = false; |
| 476 | 479 |
| 477 if (args["passphrase_setting_rejected"]) | 480 if (args["passphrase_setting_rejected"]) |
| 478 $('incorrect-passphrase').hidden = false; | 481 $('incorrect-passphrase').hidden = false; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 493 // likely he intends to change the data types. Select the | 496 // likely he intends to change the data types. Select the |
| 494 // 'Choose data types' option in this case. | 497 // 'Choose data types' option in this case. |
| 495 var index = syncEverything ? 0 : 1; | 498 var index = syncEverything ? 0 : 1; |
| 496 document.getElementById('sync-select-datatypes').selectedIndex = index; | 499 document.getElementById('sync-select-datatypes').selectedIndex = index; |
| 497 this.setDataTypeCheckboxesEnabled_(!syncEverything); | 500 this.setDataTypeCheckboxesEnabled_(!syncEverything); |
| 498 | 501 |
| 499 // The passphrase input may need to take over focus from the OK button, so | 502 // The passphrase input may need to take over focus from the OK button, so |
| 500 // set focus before that logic. | 503 // set focus before that logic. |
| 501 $('choose-datatypes-ok').focus(); | 504 $('choose-datatypes-ok').focus(); |
| 502 | 505 |
| 503 if (args && args['show_passphrase']) | 506 if (args && args['show_passphrase']) { |
| 504 this.showPassphraseContainer_(args); | 507 this.showPassphraseContainer_(args); |
| 508 } else { | |
| 509 // We only show the "Use Default" link if we're not prompting for an | |
| 510 // existing passphrase. | |
| 511 var self = this; | |
| 512 this.animateDisableLink_($('use-default-link'), false, function() { | |
| 513 self.showSyncEverythingPage_(); | |
| 514 }); | |
| 515 } | |
| 505 }, | 516 }, |
| 506 | 517 |
| 507 attach_: function() { | 518 attach_: function() { |
| 508 chrome.send('SyncSetupAttachHandler'); | 519 chrome.send('SyncSetupAttachHandler'); |
| 509 }, | 520 }, |
| 510 | 521 |
| 511 showSyncSetupPage_: function(page, args) { | 522 showSyncSetupPage_: function(page, args) { |
| 512 if (page == 'settingUp') { | 523 if (page == 'settingUp') { |
| 513 this.setThrobbersVisible_(true); | 524 this.setThrobbersVisible_(true); |
| 514 return; | 525 return; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 802 | 813 |
| 803 SyncSetupOverlay.showStopSyncingUI = function() { | 814 SyncSetupOverlay.showStopSyncingUI = function() { |
| 804 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 815 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 805 }; | 816 }; |
| 806 | 817 |
| 807 // Export | 818 // Export |
| 808 return { | 819 return { |
| 809 SyncSetupOverlay: SyncSetupOverlay | 820 SyncSetupOverlay: SyncSetupOverlay |
| 810 }; | 821 }; |
| 811 }); | 822 }); |
| OLD | NEW |