| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 $('choose-datatypes-cancel').onclick = | 57 $('choose-datatypes-cancel').onclick = |
| 58 $('sync-setup-cancel').onclick = | 58 $('sync-setup-cancel').onclick = |
| 59 $('confirm-everything-cancel').onclick = | 59 $('confirm-everything-cancel').onclick = |
| 60 $('stop-syncing-cancel').onclick = | 60 $('stop-syncing-cancel').onclick = |
| 61 $('sync-spinner-cancel').onclick = function() { | 61 $('sync-spinner-cancel').onclick = function() { |
| 62 self.closeOverlay_(); | 62 self.closeOverlay_(); |
| 63 }; | 63 }; |
| 64 $('confirm-everything-ok').onclick = function() { | 64 $('confirm-everything-ok').onclick = function() { |
| 65 self.sendConfiguration_(); | 65 self.sendConfiguration_(); |
| 66 }; | 66 }; |
| 67 $('timeout-ok').onclick = function() { |
| 68 chrome.send('CloseTimeout'); |
| 69 self.closeOverlay_(); |
| 70 }; |
| 67 $('stop-syncing-ok').onclick = function() { | 71 $('stop-syncing-ok').onclick = function() { |
| 68 chrome.send('SyncSetupStopSyncing'); | 72 chrome.send('SyncSetupStopSyncing'); |
| 69 self.closeOverlay_(); | 73 self.closeOverlay_(); |
| 70 }; | 74 }; |
| 71 }, | 75 }, |
| 72 | 76 |
| 73 showOverlay_: function() { | 77 showOverlay_: function() { |
| 74 OptionsPage.navigateToPage('syncSetup'); | 78 OptionsPage.navigateToPage('syncSetup'); |
| 75 }, | 79 }, |
| 76 | 80 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 413 } |
| 410 } | 414 } |
| 411 }, | 415 }, |
| 412 | 416 |
| 413 showSpinner_: function() { | 417 showSpinner_: function() { |
| 414 this.resetPage_('sync-setup-spinner'); | 418 this.resetPage_('sync-setup-spinner'); |
| 415 $('sync-setup-spinner').hidden = false; | 419 $('sync-setup-spinner').hidden = false; |
| 416 this.setThrobbersVisible_(true); | 420 this.setThrobbersVisible_(true); |
| 417 }, | 421 }, |
| 418 | 422 |
| 423 showTimeoutPage_: function() { |
| 424 this.resetPage_('sync-setup-timeout'); |
| 425 $('sync-setup-timeout').hidden = false; |
| 426 }, |
| 427 |
| 419 showSyncEverythingPage_: function() { | 428 showSyncEverythingPage_: function() { |
| 420 $('confirm-sync-preferences').hidden = false; | 429 $('confirm-sync-preferences').hidden = false; |
| 421 $('customize-sync-preferences').hidden = true; | 430 $('customize-sync-preferences').hidden = true; |
| 422 | 431 |
| 423 // Reset the selection to 'Sync everything'. | 432 // Reset the selection to 'Sync everything'. |
| 424 $('sync-select-datatypes').selectedIndex = 0; | 433 $('sync-select-datatypes').selectedIndex = 0; |
| 425 | 434 |
| 426 // The default state is to sync everything. | 435 // The default state is to sync everything. |
| 427 this.setCheckboxesToKeepEverythingSynced_(true); | 436 this.setCheckboxesToKeepEverythingSynced_(true); |
| 428 | 437 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 this.closeOverlay_(); | 546 this.closeOverlay_(); |
| 538 else | 547 else |
| 539 this.showOverlay_(); | 548 this.showOverlay_(); |
| 540 | 549 |
| 541 if (page == 'login') | 550 if (page == 'login') |
| 542 this.showGaiaLogin_(args); | 551 this.showGaiaLogin_(args); |
| 543 else if (page == 'configure' || page == 'passphrase') | 552 else if (page == 'configure' || page == 'passphrase') |
| 544 this.showConfigure_(args); | 553 this.showConfigure_(args); |
| 545 else if (page == 'spinner') | 554 else if (page == 'spinner') |
| 546 this.showSpinner_(); | 555 this.showSpinner_(); |
| 556 else if (page == 'timeout') |
| 557 this.showTimeoutPage_(); |
| 547 }, | 558 }, |
| 548 | 559 |
| 549 /** | 560 /** |
| 550 * Changes the visibility of throbbers on this page. | 561 * Changes the visibility of throbbers on this page. |
| 551 * @param {boolean} visible Whether or not to set all throbber nodes | 562 * @param {boolean} visible Whether or not to set all throbber nodes |
| 552 * visible. | 563 * visible. |
| 553 */ | 564 */ |
| 554 setThrobbersVisible_: function(visible) { | 565 setThrobbersVisible_: function(visible) { |
| 555 var throbbers = document.getElementsByClassName('throbber'); | 566 var throbbers = document.getElementsByClassName('throbber'); |
| 556 for (var i = 0; i < throbbers.length; i++) | 567 for (var i = 0; i < throbbers.length; i++) |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 | 970 |
| 960 SyncSetupOverlay.showStopSyncingUI = function() { | 971 SyncSetupOverlay.showStopSyncingUI = function() { |
| 961 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 972 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 962 }; | 973 }; |
| 963 | 974 |
| 964 // Export | 975 // Export |
| 965 return { | 976 return { |
| 966 SyncSetupOverlay: SyncSetupOverlay | 977 SyncSetupOverlay: SyncSetupOverlay |
| 967 }; | 978 }; |
| 968 }); | 979 }); |
| OLD | NEW |