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 /** | 5 /** |
6 * @fileoverview Oobe signin screen implementation. | 6 * @fileoverview Oobe signin screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { | 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
10 // Gaia loading time after which error message must be displayed and | 10 // Gaia loading time after which error message must be displayed and |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 this.gaiaAuthHost_.samlApiUsedCallback = | 163 this.gaiaAuthHost_.samlApiUsedCallback = |
164 this.samlApiUsed_.bind(this); | 164 this.samlApiUsed_.bind(this); |
165 this.gaiaAuthHost_.addEventListener('authDomainChange', | 165 this.gaiaAuthHost_.addEventListener('authDomainChange', |
166 this.onAuthDomainChange_.bind(this)); | 166 this.onAuthDomainChange_.bind(this)); |
167 this.gaiaAuthHost_.addEventListener('authFlowChange', | 167 this.gaiaAuthHost_.addEventListener('authFlowChange', |
168 this.onAuthFlowChange_.bind(this)); | 168 this.onAuthFlowChange_.bind(this)); |
169 this.gaiaAuthHost_.addEventListener('authCompleted', | 169 this.gaiaAuthHost_.addEventListener('authCompleted', |
170 this.onAuthCompletedMessage_.bind(this)); | 170 this.onAuthCompletedMessage_.bind(this)); |
171 this.gaiaAuthHost_.addEventListener('loadAbort', | 171 this.gaiaAuthHost_.addEventListener('loadAbort', |
172 this.onLoadAbortMessage_.bind(this)); | 172 this.onLoadAbortMessage_.bind(this)); |
| 173 this.gaiaAuthHost_.addEventListener( |
| 174 'identifierEntered', this.onIdentifierEnteredMessage_.bind(this)); |
173 | 175 |
174 $('enterprise-info-hint-link').addEventListener('click', function(e) { | 176 $('enterprise-info-hint-link').addEventListener('click', function(e) { |
175 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); | 177 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); |
176 e.preventDefault(); | 178 e.preventDefault(); |
177 }); | 179 }); |
178 | 180 |
179 $('back-button-item').addEventListener('click', function(e) { | 181 $('back-button-item').addEventListener('click', function(e) { |
180 $('back-button-item').hidden = true; | 182 $('back-button-item').hidden = true; |
181 $('signin-frame').back(); | 183 $('signin-frame').back(); |
182 e.preventDefault(); | 184 e.preventDefault(); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 /** | 766 /** |
765 * Invoked when onLoadAbort message received. | 767 * Invoked when onLoadAbort message received. |
766 * @param {!Object} e Payload of the received HTML5 message. | 768 * @param {!Object} e Payload of the received HTML5 message. |
767 * @private | 769 * @private |
768 */ | 770 */ |
769 onLoadAbortMessage_: function(e) { | 771 onLoadAbortMessage_: function(e) { |
770 this.onWebviewError(e.detail); | 772 this.onWebviewError(e.detail); |
771 }, | 773 }, |
772 | 774 |
773 /** | 775 /** |
| 776 * Invoked when identifierEntered message received. |
| 777 * @param {!Object} e Payload of the received HTML5 message. |
| 778 * @private |
| 779 */ |
| 780 onIdentifierEnteredMessage_: function(e) { |
| 781 this.onIdentifierEntered(e.detail); |
| 782 }, |
| 783 |
| 784 /** |
774 * Clears input fields and switches to input mode. | 785 * Clears input fields and switches to input mode. |
775 * @param {boolean} takeFocus True to take focus. | 786 * @param {boolean} takeFocus True to take focus. |
776 * @param {boolean} forceOnline Whether online sign-in should be forced. | 787 * @param {boolean} forceOnline Whether online sign-in should be forced. |
777 * If |forceOnline| is false previously used sign-in type will be used. | 788 * If |forceOnline| is false previously used sign-in type will be used. |
778 */ | 789 */ |
779 reset: function(takeFocus, forceOnline) { | 790 reset: function(takeFocus, forceOnline) { |
780 // Reload and show the sign-in UI if needed. | 791 // Reload and show the sign-in UI if needed. |
781 if (takeFocus) { | 792 if (takeFocus) { |
782 if (!forceOnline && this.isLocal) { | 793 if (!forceOnline && this.isLocal) { |
783 // Show 'Cancel' button to allow user to return to the main screen | 794 // Show 'Cancel' button to allow user to return to the main screen |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 * Handler for webview error handling. | 909 * Handler for webview error handling. |
899 * @param {!Object} data Additional information about error event like: | 910 * @param {!Object} data Additional information about error event like: |
900 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED". | 911 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED". |
901 * {string} url The URL that failed to load. | 912 * {string} url The URL that failed to load. |
902 */ | 913 */ |
903 onWebviewError: function(data) { | 914 onWebviewError: function(data) { |
904 chrome.send('webviewLoadAborted', [data.error]); | 915 chrome.send('webviewLoadAborted', [data.error]); |
905 }, | 916 }, |
906 | 917 |
907 /** | 918 /** |
| 919 * Handler for identifierEntered event. |
| 920 * @param {!Object} data The identifier entered by user: |
| 921 * {string} accountIdentifier User identifier. |
| 922 */ |
| 923 onIdentifierEntered: function(data) { |
| 924 chrome.send('identifierEntered', [data.accountIdentifier]); |
| 925 }, |
| 926 |
| 927 /** |
908 * Sets welcome and enterpriseinfo strings for offline gaia. | 928 * Sets welcome and enterpriseinfo strings for offline gaia. |
909 * Also sets callback and sends message whether we already have email and | 929 * Also sets callback and sends message whether we already have email and |
910 * should switch to the password screen with error. | 930 * should switch to the password screen with error. |
911 */ | 931 */ |
912 loadOffline: function(params) { | 932 loadOffline: function(params) { |
913 var offlineLogin = $('offline-gaia'); | 933 var offlineLogin = $('offline-gaia'); |
914 var strings = params.localizedStrings; | 934 var strings = params.localizedStrings; |
915 if ('stringEnterpriseInfo' in strings) | 935 if ('stringEnterpriseInfo' in strings) |
916 offlineLogin.enterpriseInfo = strings['stringEnterpriseInfo']; | 936 offlineLogin.enterpriseInfo = strings['stringEnterpriseInfo']; |
917 if ('emailDomain' in params) | 937 if ('emailDomain' in params) |
(...skipping 16 matching lines...) Expand all Loading... |
934 } | 954 } |
935 | 955 |
936 this.classList.toggle('whitelist-error', show); | 956 this.classList.toggle('whitelist-error', show); |
937 this.loading = !show; | 957 this.loading = !show; |
938 | 958 |
939 if (!show) | 959 if (!show) |
940 Oobe.showSigninUI(); | 960 Oobe.showSigninUI(); |
941 } | 961 } |
942 }; | 962 }; |
943 }); | 963 }); |
OLD | NEW |