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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 loginSetFocus_: function() { | 554 loginSetFocus_: function() { |
555 var email = $('gaia-email'); | 555 var email = $('gaia-email'); |
556 var passwd = $('gaia-passwd'); | 556 var passwd = $('gaia-passwd'); |
557 if (email && (email.value == null || email.value == "")) { | 557 if (email && (email.value == null || email.value == "")) { |
558 email.focus(); | 558 email.focus(); |
559 } else if (passwd) { | 559 } else if (passwd) { |
560 passwd.focus(); | 560 passwd.focus(); |
561 } | 561 } |
562 }, | 562 }, |
563 | 563 |
| 564 /** |
| 565 * Get the login email text input DOM element. |
| 566 * @return {DOMElement} The login email text input. |
| 567 * @private |
| 568 */ |
| 569 getLoginEmail_: function() { |
| 570 return $('gaia-email'); |
| 571 }, |
| 572 |
| 573 /** |
| 574 * Get the login password text input DOM element. |
| 575 * @return {DOMElement} The login password text input. |
| 576 * @private |
| 577 */ |
| 578 getLoginPasswd_: function() { |
| 579 return $('gaia-passwd'); |
| 580 }, |
| 581 |
| 582 /** |
| 583 * Get the sign in button DOM element. |
| 584 * @return {DOMElement} The sign in button. |
| 585 * @private |
| 586 */ |
| 587 getSignInButton_: function() { |
| 588 return $('sign-in'); |
| 589 }, |
| 590 |
564 showAccessCodeRequired_: function() { | 591 showAccessCodeRequired_: function() { |
565 $('password-row').hidden = true; | 592 $('password-row').hidden = true; |
566 $('email-row').hidden = true; | 593 $('email-row').hidden = true; |
567 | 594 |
568 $('access-code-input-row').hidden = false; | 595 $('access-code-input-row').hidden = false; |
569 $('access-code').disabled = false; | 596 $('access-code').disabled = false; |
570 }, | 597 }, |
571 | 598 |
572 showCaptcha_: function(args) { | 599 showCaptcha_: function(args) { |
573 this.captchaChallengeActive_ = true; | 600 this.captchaChallengeActive_ = true; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 /** | 839 /** |
813 * Hides the outer elements of the login UI. This is used by the sync promo | 840 * Hides the outer elements of the login UI. This is used by the sync promo |
814 * to customize the look of the login box. | 841 * to customize the look of the login box. |
815 */ | 842 */ |
816 hideOuterLoginUI_: function() { | 843 hideOuterLoginUI_: function() { |
817 $('sync-setup-overlay-title').hidden = true; | 844 $('sync-setup-overlay-title').hidden = true; |
818 $('sync-setup-cancel').hidden = true; | 845 $('sync-setup-cancel').hidden = true; |
819 } | 846 } |
820 }; | 847 }; |
821 | 848 |
| 849 // These get methods should only be called by the WebUI tests. |
| 850 SyncSetupOverlay.getLoginEmail = function() { |
| 851 return SyncSetupOverlay.getInstance().getLoginEmail_(); |
| 852 }; |
| 853 |
| 854 SyncSetupOverlay.getLoginPasswd = function() { |
| 855 return SyncSetupOverlay.getInstance().getLoginPasswd_(); |
| 856 }; |
| 857 |
| 858 SyncSetupOverlay.getSignInButton = function() { |
| 859 return SyncSetupOverlay.getInstance().getSignInButton_(); |
| 860 }; |
| 861 |
| 862 // These methods are for general consumption. |
822 SyncSetupOverlay.showErrorUI = function() { | 863 SyncSetupOverlay.showErrorUI = function() { |
823 SyncSetupOverlay.getInstance().showErrorUI_(); | 864 SyncSetupOverlay.getInstance().showErrorUI_(); |
824 }; | 865 }; |
825 | 866 |
826 SyncSetupOverlay.showSetupUI = function() { | 867 SyncSetupOverlay.showSetupUI = function() { |
827 SyncSetupOverlay.getInstance().showSetupUI_(); | 868 SyncSetupOverlay.getInstance().showSetupUI_(); |
828 }; | 869 }; |
829 | 870 |
830 SyncSetupOverlay.showSyncSetupPage = function(page, args) { | 871 SyncSetupOverlay.showSyncSetupPage = function(page, args) { |
831 SyncSetupOverlay.getInstance().showSyncSetupPage_(page, args); | 872 SyncSetupOverlay.getInstance().showSyncSetupPage_(page, args); |
832 }; | 873 }; |
833 | 874 |
834 SyncSetupOverlay.showSuccessAndClose = function() { | 875 SyncSetupOverlay.showSuccessAndClose = function() { |
835 SyncSetupOverlay.getInstance().showSuccessAndClose_(); | 876 SyncSetupOverlay.getInstance().showSuccessAndClose_(); |
836 }; | 877 }; |
837 | 878 |
838 SyncSetupOverlay.showSuccessAndSettingUp = function() { | 879 SyncSetupOverlay.showSuccessAndSettingUp = function() { |
839 SyncSetupOverlay.getInstance().showSuccessAndSettingUp_(); | 880 SyncSetupOverlay.getInstance().showSuccessAndSettingUp_(); |
840 }; | 881 }; |
841 | 882 |
842 SyncSetupOverlay.showStopSyncingUI = function() { | 883 SyncSetupOverlay.showStopSyncingUI = function() { |
843 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 884 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
844 }; | 885 }; |
845 | 886 |
846 // Export | 887 // Export |
847 return { | 888 return { |
848 SyncSetupOverlay: SyncSetupOverlay | 889 SyncSetupOverlay: SyncSetupOverlay |
849 }; | 890 }; |
850 }); | 891 }); |
OLD | NEW |