| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 this.showGaiaLogin_(args); | 531 this.showGaiaLogin_(args); |
| 532 else if (page == 'configure' || page == 'passphrase') | 532 else if (page == 'configure' || page == 'passphrase') |
| 533 this.showConfigure_(args); | 533 this.showConfigure_(args); |
| 534 | 534 |
| 535 if (page == 'done') | 535 if (page == 'done') |
| 536 this.closeOverlay_(); | 536 this.closeOverlay_(); |
| 537 else | 537 else |
| 538 this.showOverlay_(); | 538 this.showOverlay_(); |
| 539 }, | 539 }, |
| 540 | 540 |
| 541 /** |
| 542 * Changes the visibility of throbbers on this page. |
| 543 * @param {boolean} visible Whether or not to set all throbber nodes |
| 544 * visible. |
| 545 */ |
| 541 setThrobbersVisible_: function(visible) { | 546 setThrobbersVisible_: function(visible) { |
| 542 var throbbers = document.getElementsByClassName("throbber"); | 547 var throbbers = document.getElementsByClassName("throbber"); |
| 543 for (var i = 0; i < throbbers.length; i++) | 548 for (var i = 0; i < throbbers.length; i++) |
| 544 throbbers[i].style.visibility = visible ? "visible" : "hidden"; | 549 throbbers[i].style.visibility = visible ? "visible" : "hidden"; |
| 545 }, | 550 }, |
| 546 | 551 |
| 547 loginSetFocus_: function() { | 552 loginSetFocus_: function() { |
| 548 var email = $('gaia-email'); | 553 var email = $('gaia-email'); |
| 549 var passwd = $('gaia-passwd'); | 554 var passwd = $('gaia-passwd'); |
| 550 if (email && (email.value == null || email.value == "")) { | 555 if (email && (email.value == null || email.value == "")) { |
| 551 email.focus(); | 556 email.focus(); |
| 552 } else if (passwd) { | 557 } else if (passwd) { |
| 553 passwd.focus(); | 558 passwd.focus(); |
| 554 } | 559 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 sendCredentialsAndClose_: function() { | 769 sendCredentialsAndClose_: function() { |
| 765 if (!this.setErrorVisibility_()) { | 770 if (!this.setErrorVisibility_()) { |
| 766 return false; | 771 return false; |
| 767 } | 772 } |
| 768 | 773 |
| 769 $('gaia-email').disabled = true; | 774 $('gaia-email').disabled = true; |
| 770 $('gaia-passwd').disabled = true; | 775 $('gaia-passwd').disabled = true; |
| 771 $('captcha-value').disabled = true; | 776 $('captcha-value').disabled = true; |
| 772 $('access-code').disabled = true; | 777 $('access-code').disabled = true; |
| 773 | 778 |
| 774 $('logging-in-throbber').style.visibility = "visible"; | 779 this.setThrobbersVisible_(true); |
| 775 | 780 |
| 776 var f = $('gaia-login-form'); | 781 var f = $('gaia-login-form'); |
| 777 var email = $('gaia-email'); | 782 var email = $('gaia-email'); |
| 778 var passwd = $('gaia-passwd'); | 783 var passwd = $('gaia-passwd'); |
| 779 var result = JSON.stringify({"user" : email.value, | 784 var result = JSON.stringify({"user" : email.value, |
| 780 "pass" : passwd.value, | 785 "pass" : passwd.value, |
| 781 "captcha" : f.captchaValue.value, | 786 "captcha" : f.captchaValue.value, |
| 782 "access_code" : f.accessCode.value}); | 787 "access_code" : f.accessCode.value}); |
| 783 $('sign-in').disabled = true; | 788 $('sign-in').disabled = true; |
| 784 chrome.send('SyncSetupSubmitAuth', [result]); | 789 chrome.send('SyncSetupSubmitAuth', [result]); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 880 |
| 876 SyncSetupOverlay.showStopSyncingUI = function() { | 881 SyncSetupOverlay.showStopSyncingUI = function() { |
| 877 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 882 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 878 }; | 883 }; |
| 879 | 884 |
| 880 // Export | 885 // Export |
| 881 return { | 886 return { |
| 882 SyncSetupOverlay: SyncSetupOverlay | 887 SyncSetupOverlay: SyncSetupOverlay |
| 883 }; | 888 }; |
| 884 }); | 889 }); |
| OLD | NEW |