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() { |
| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // doesn't work). | 520 // doesn't work). |
514 if (page == 'done') | 521 if (page == 'done') |
515 this.closeOverlay_(); | 522 this.closeOverlay_(); |
516 else | 523 else |
517 this.showOverlay_(); | 524 this.showOverlay_(); |
518 | 525 |
519 if (page == 'login') | 526 if (page == 'login') |
520 this.showGaiaLogin_(args); | 527 this.showGaiaLogin_(args); |
521 else if (page == 'configure' || page == 'passphrase') | 528 else if (page == 'configure' || page == 'passphrase') |
522 this.showConfigure_(args); | 529 this.showConfigure_(args); |
| 530 else if (page == 'spinner') |
| 531 this.showSpinner_(); |
523 }, | 532 }, |
524 | 533 |
525 /** | 534 /** |
526 * Changes the visibility of throbbers on this page. | 535 * Changes the visibility of throbbers on this page. |
527 * @param {boolean} visible Whether or not to set all throbber nodes | 536 * @param {boolean} visible Whether or not to set all throbber nodes |
528 * visible. | 537 * visible. |
529 */ | 538 */ |
530 setThrobbersVisible_: function(visible) { | 539 setThrobbersVisible_: function(visible) { |
531 var throbbers = document.getElementsByClassName('throbber'); | 540 var throbbers = document.getElementsByClassName('throbber'); |
532 for (var i = 0; i < throbbers.length; i++) | 541 for (var i = 0; i < throbbers.length; i++) |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 879 |
871 SyncSetupOverlay.showStopSyncingUI = function() { | 880 SyncSetupOverlay.showStopSyncingUI = function() { |
872 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 881 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
873 }; | 882 }; |
874 | 883 |
875 // Export | 884 // Export |
876 return { | 885 return { |
877 SyncSetupOverlay: SyncSetupOverlay | 886 SyncSetupOverlay: SyncSetupOverlay |
878 }; | 887 }; |
879 }); | 888 }); |
OLD | NEW |