Chromium Code Reviews| 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 var visibleOrHidden = visible ? "visible" : "hidden"; |
|
Evan Stade
2011/11/15 17:45:19
revert the changes to this function
Dan Beam
2011/11/15 18:37:13
OK, I can, but why? I removed the loop invariant
Evan Stade
2011/11/15 22:46:41
you can leave the docs and the indentation change.
Dan Beam
2011/11/16 00:09:53
Done. Crankshaft should optimize the loop invaria
| |
| 544 throbbers[i].style.visibility = visible ? "visible" : "hidden"; | 549 for (var i = 0, l = throbbers.length; i < l; ++i) |
| 550 throbbers[i].style.visibility = visibleOrHidden; | |
| 545 }, | 551 }, |
| 546 | 552 |
| 547 loginSetFocus_: function() { | 553 loginSetFocus_: function() { |
| 548 var email = $('gaia-email'); | 554 var email = $('gaia-email'); |
| 549 var passwd = $('gaia-passwd'); | 555 var passwd = $('gaia-passwd'); |
| 550 if (email && (email.value == null || email.value == "")) { | 556 if (email && (email.value == null || email.value == "")) { |
| 551 email.focus(); | 557 email.focus(); |
| 552 } else if (passwd) { | 558 } else if (passwd) { |
| 553 passwd.focus(); | 559 passwd.focus(); |
| 554 } | 560 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 sendCredentialsAndClose_: function() { | 743 sendCredentialsAndClose_: function() { |
| 738 if (!this.setErrorVisibility_()) { | 744 if (!this.setErrorVisibility_()) { |
| 739 return false; | 745 return false; |
| 740 } | 746 } |
| 741 | 747 |
| 742 $('gaia-email').disabled = true; | 748 $('gaia-email').disabled = true; |
| 743 $('gaia-passwd').disabled = true; | 749 $('gaia-passwd').disabled = true; |
| 744 $('captcha-value').disabled = true; | 750 $('captcha-value').disabled = true; |
| 745 $('access-code').disabled = true; | 751 $('access-code').disabled = true; |
| 746 | 752 |
| 747 $('logging-in-throbber').style.visibility = "visible"; | 753 this.setThrobbersVisible_(true); |
| 748 | 754 |
| 749 var f = $('gaia-login-form'); | 755 var f = $('gaia-login-form'); |
| 750 var email = $('gaia-email'); | 756 var email = $('gaia-email'); |
| 751 var passwd = $('gaia-passwd'); | 757 var passwd = $('gaia-passwd'); |
| 752 var result = JSON.stringify({"user" : email.value, | 758 var result = JSON.stringify({"user" : email.value, |
| 753 "pass" : passwd.value, | 759 "pass" : passwd.value, |
| 754 "captcha" : f.captchaValue.value, | 760 "captcha" : f.captchaValue.value, |
| 755 "access_code" : f.accessCode.value}); | 761 "access_code" : f.accessCode.value}); |
| 756 $('sign-in').disabled = true; | 762 $('sign-in').disabled = true; |
| 757 chrome.send('SyncSetupSubmitAuth', [result]); | 763 chrome.send('SyncSetupSubmitAuth', [result]); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 | 840 |
| 835 SyncSetupOverlay.showStopSyncingUI = function() { | 841 SyncSetupOverlay.showStopSyncingUI = function() { |
| 836 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 842 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 837 }; | 843 }; |
| 838 | 844 |
| 839 // Export | 845 // Export |
| 840 return { | 846 return { |
| 841 SyncSetupOverlay: SyncSetupOverlay | 847 SyncSetupOverlay: SyncSetupOverlay |
| 842 }; | 848 }; |
| 843 }); | 849 }); |
| OLD | NEW |