| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 $('gaia-login-form').onsubmit = function() { | 44 $('gaia-login-form').onsubmit = function() { |
| 45 self.sendCredentialsAndClose_(); | 45 self.sendCredentialsAndClose_(); |
| 46 return false; | 46 return false; |
| 47 }; | 47 }; |
| 48 $('google-option').onchange = $('explicit-option').onchange = function() { | 48 $('google-option').onchange = $('explicit-option').onchange = function() { |
| 49 self.onPassphraseRadioChanged_(); | 49 self.onPassphraseRadioChanged_(); |
| 50 }; | 50 }; |
| 51 $('choose-datatypes-cancel').onclick = | 51 $('choose-datatypes-cancel').onclick = |
| 52 $('sync-setup-cancel').onclick = | 52 $('sync-setup-cancel').onclick = |
| 53 $('confirm-everything-cancel').onclick = | 53 $('confirm-everything-cancel').onclick = |
| 54 $('stop-syncing-cancel').onclick = function() { | 54 $('stop-syncing-cancel').onclick = |
| 55 $('sync-spinner-cancel').onclick = function() { |
| 55 self.closeOverlay_(); | 56 self.closeOverlay_(); |
| 56 }; | 57 }; |
| 57 $('confirm-everything-ok').onclick = function() { | 58 $('confirm-everything-ok').onclick = function() { |
| 58 self.sendConfiguration_(); | 59 self.sendConfiguration_(); |
| 59 }; | 60 }; |
| 60 $('stop-syncing-ok').onclick = function() { | 61 $('stop-syncing-ok').onclick = function() { |
| 61 chrome.send('stopSyncing'); | 62 chrome.send('stopSyncing'); |
| 62 self.closeOverlay_(); | 63 self.closeOverlay_(); |
| 63 }; | 64 }; |
| 64 }, | 65 }, |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 this.usePassphrase_ = args['usePassphrase']; | 390 this.usePassphrase_ = args['usePassphrase']; |
| 390 if (args['showSyncEverythingPage'] == false || this.usePassphrase_ || | 391 if (args['showSyncEverythingPage'] == false || this.usePassphrase_ || |
| 391 syncAllDataTypes == false || args['show_passphrase']) { | 392 syncAllDataTypes == false || args['show_passphrase']) { |
| 392 this.showCustomizePage_(args, syncAllDataTypes); | 393 this.showCustomizePage_(args, syncAllDataTypes); |
| 393 } else { | 394 } else { |
| 394 this.showSyncEverythingPage_(); | 395 this.showSyncEverythingPage_(); |
| 395 } | 396 } |
| 396 } | 397 } |
| 397 }, | 398 }, |
| 398 | 399 |
| 400 showSpinner_: function(args) { |
| 401 this.resetPage_('sync-setup-spinner'); |
| 402 $('sync-setup-spinner').hidden = false; |
| 403 this.setThrobbersVisible_(true); |
| 404 }, |
| 405 |
| 399 showSyncEverythingPage_: function() { | 406 showSyncEverythingPage_: function() { |
| 400 $('confirm-sync-preferences').hidden = false; | 407 $('confirm-sync-preferences').hidden = false; |
| 401 $('customize-sync-preferences').hidden = true; | 408 $('customize-sync-preferences').hidden = true; |
| 402 | 409 |
| 403 // Reset the selection to 'Sync everything'. | 410 // Reset the selection to 'Sync everything'. |
| 404 $('sync-select-datatypes').selectedIndex = 0; | 411 $('sync-select-datatypes').selectedIndex = 0; |
| 405 | 412 |
| 406 // The default state is to sync everything. | 413 // The default state is to sync everything. |
| 407 this.setCheckboxesToKeepEverythingSynced_(true); | 414 this.setCheckboxesToKeepEverythingSynced_(true); |
| 408 | 415 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 var overlay = $('sync-setup-overlay'); | 505 var overlay = $('sync-setup-overlay'); |
| 499 for (var i = 0; i < overlay.children.length; i++) | 506 for (var i = 0; i < overlay.children.length; i++) |
| 500 overlay.children[i].hidden = true; | 507 overlay.children[i].hidden = true; |
| 501 | 508 |
| 502 this.setInputElementsDisabledState_(false); | 509 this.setInputElementsDisabledState_(false); |
| 503 | 510 |
| 504 if (page == 'login') | 511 if (page == 'login') |
| 505 this.showGaiaLogin_(args); | 512 this.showGaiaLogin_(args); |
| 506 else if (page == 'configure' || page == 'passphrase') | 513 else if (page == 'configure' || page == 'passphrase') |
| 507 this.showConfigure_(args); | 514 this.showConfigure_(args); |
| 515 else if (page == 'spinner') |
| 516 this.showSpinner_(args); |
| 508 | 517 |
| 509 if (page == 'done') | 518 if (page == 'done') |
| 510 this.closeOverlay_(); | 519 this.closeOverlay_(); |
| 511 else | 520 else |
| 512 this.showOverlay_(); | 521 this.showOverlay_(); |
| 513 }, | 522 }, |
| 514 | 523 |
| 515 /** | 524 /** |
| 516 * Changes the visibility of throbbers on this page. | 525 * Changes the visibility of throbbers on this page. |
| 517 * @param {boolean} visible Whether or not to set all throbber nodes | 526 * @param {boolean} visible Whether or not to set all throbber nodes |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 | 863 |
| 855 SyncSetupOverlay.showStopSyncingUI = function() { | 864 SyncSetupOverlay.showStopSyncingUI = function() { |
| 856 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 865 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 857 }; | 866 }; |
| 858 | 867 |
| 859 // Export | 868 // Export |
| 860 return { | 869 return { |
| 861 SyncSetupOverlay: SyncSetupOverlay | 870 SyncSetupOverlay: SyncSetupOverlay |
| 862 }; | 871 }; |
| 863 }); | 872 }); |
| OLD | NEW |