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 */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 var self = this; | 49 var self = this; |
50 $('gaia-login-form').onsubmit = function() { | 50 $('gaia-login-form').onsubmit = function() { |
51 self.sendCredentialsAndClose_(); | 51 self.sendCredentialsAndClose_(); |
52 return false; | 52 return false; |
53 }; | 53 }; |
54 $('google-option').onchange = $('explicit-option').onchange = function() { | 54 $('google-option').onchange = $('explicit-option').onchange = function() { |
55 self.onPassphraseRadioChanged_(); | 55 self.onPassphraseRadioChanged_(); |
56 }; | 56 }; |
57 $('choose-datatypes-cancel').onclick = | 57 $('choose-datatypes-cancel').onclick = |
58 $('sync-setup-cancel').onclick = | 58 $('sync-setup-cancel').onclick = |
| 59 $('timeout-ok').onclick = |
59 $('confirm-everything-cancel').onclick = | 60 $('confirm-everything-cancel').onclick = |
60 $('stop-syncing-cancel').onclick = | 61 $('stop-syncing-cancel').onclick = |
61 $('sync-spinner-cancel').onclick = function() { | 62 $('sync-spinner-cancel').onclick = function() { |
62 self.closeOverlay_(); | 63 self.closeOverlay_(); |
63 }; | 64 }; |
64 $('confirm-everything-ok').onclick = function() { | 65 $('confirm-everything-ok').onclick = function() { |
65 self.sendConfiguration_(); | 66 self.sendConfiguration_(); |
66 }; | 67 }; |
67 $('stop-syncing-ok').onclick = function() { | 68 $('stop-syncing-ok').onclick = function() { |
68 chrome.send('SyncSetupStopSyncing'); | 69 chrome.send('SyncSetupStopSyncing'); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 410 } |
410 } | 411 } |
411 }, | 412 }, |
412 | 413 |
413 showSpinner_: function() { | 414 showSpinner_: function() { |
414 this.resetPage_('sync-setup-spinner'); | 415 this.resetPage_('sync-setup-spinner'); |
415 $('sync-setup-spinner').hidden = false; | 416 $('sync-setup-spinner').hidden = false; |
416 this.setThrobbersVisible_(true); | 417 this.setThrobbersVisible_(true); |
417 }, | 418 }, |
418 | 419 |
| 420 showTimeOutPage_: function() { |
| 421 this.resetPage_('sync-setup-timeout'); |
| 422 $('sync-setup-timeout').hidden = false; |
| 423 }, |
| 424 |
419 showSyncEverythingPage_: function() { | 425 showSyncEverythingPage_: function() { |
420 $('confirm-sync-preferences').hidden = false; | 426 $('confirm-sync-preferences').hidden = false; |
421 $('customize-sync-preferences').hidden = true; | 427 $('customize-sync-preferences').hidden = true; |
422 | 428 |
423 // Reset the selection to 'Sync everything'. | 429 // Reset the selection to 'Sync everything'. |
424 $('sync-select-datatypes').selectedIndex = 0; | 430 $('sync-select-datatypes').selectedIndex = 0; |
425 | 431 |
426 // The default state is to sync everything. | 432 // The default state is to sync everything. |
427 this.setCheckboxesToKeepEverythingSynced_(true); | 433 this.setCheckboxesToKeepEverythingSynced_(true); |
428 | 434 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 this.closeOverlay_(); | 543 this.closeOverlay_(); |
538 else | 544 else |
539 this.showOverlay_(); | 545 this.showOverlay_(); |
540 | 546 |
541 if (page == 'login') | 547 if (page == 'login') |
542 this.showGaiaLogin_(args); | 548 this.showGaiaLogin_(args); |
543 else if (page == 'configure' || page == 'passphrase') | 549 else if (page == 'configure' || page == 'passphrase') |
544 this.showConfigure_(args); | 550 this.showConfigure_(args); |
545 else if (page == 'spinner') | 551 else if (page == 'spinner') |
546 this.showSpinner_(); | 552 this.showSpinner_(); |
| 553 else if (page == 'timeout') |
| 554 this.showTimeOutPage_(); |
547 }, | 555 }, |
548 | 556 |
549 /** | 557 /** |
550 * Changes the visibility of throbbers on this page. | 558 * Changes the visibility of throbbers on this page. |
551 * @param {boolean} visible Whether or not to set all throbber nodes | 559 * @param {boolean} visible Whether or not to set all throbber nodes |
552 * visible. | 560 * visible. |
553 */ | 561 */ |
554 setThrobbersVisible_: function(visible) { | 562 setThrobbersVisible_: function(visible) { |
555 var throbbers = document.getElementsByClassName('throbber'); | 563 var throbbers = document.getElementsByClassName('throbber'); |
556 for (var i = 0; i < throbbers.length; i++) | 564 for (var i = 0; i < throbbers.length; i++) |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 | 933 |
926 SyncSetupOverlay.showStopSyncingUI = function() { | 934 SyncSetupOverlay.showStopSyncingUI = function() { |
927 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 935 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
928 }; | 936 }; |
929 | 937 |
930 // Export | 938 // Export |
931 return { | 939 return { |
932 SyncSetupOverlay: SyncSetupOverlay | 940 SyncSetupOverlay: SyncSetupOverlay |
933 }; | 941 }; |
934 }); | 942 }); |
OLD | NEW |