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 |
11 // lazy portal check should be fired. | 11 // lazy portal check should be fired. |
12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; | 12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; |
13 | 13 |
14 // Maximum Gaia loading time in seconds. | 14 // Maximum Gaia loading time in seconds. |
15 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; | 15 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; |
16 | 16 |
17 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; | 17 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; |
18 | 18 |
19 // The help topic regarding user not being in the whitelist. | 19 // The help topic regarding user not being in the whitelist. |
20 /** @const */ var HELP_CANT_ACCESS_ACCOUNT = 188036; | 20 /** @const */ var HELP_CANT_ACCESS_ACCOUNT = 188036; |
21 | 21 |
22 return { | 22 return { |
23 EXTERNAL_API: [ | 23 EXTERNAL_API: [ |
24 'loadAuthExtension', | 24 'loadAuthExtension', |
25 'updateAuthExtension', | 25 'updateAuthExtension', |
26 'doReload', | 26 'doReload', |
27 'onWebviewError', | 27 'onWebviewError', |
28 'onFrameError', | 28 'onFrameError', |
29 'updateCancelButtonState', | 29 'updateCancelButtonState', |
30 'showWhitelistCheckFailedError' | 30 'showWhitelistCheckFailedError', |
31 'updateDeviceId', | |
31 ], | 32 ], |
32 | 33 |
33 /** | 34 /** |
34 * Frame loading error code (0 - no error). | 35 * Frame loading error code (0 - no error). |
35 * @type {number} | 36 * @type {number} |
36 * @private | 37 * @private |
37 */ | 38 */ |
38 error_: 0, | 39 error_: 0, |
39 | 40 |
40 /** | 41 /** |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 this.gaiaAuthHost_.addEventListener( | 125 this.gaiaAuthHost_.addEventListener( |
125 'ready', this.onAuthReady_.bind(this)); | 126 'ready', this.onAuthReady_.bind(this)); |
126 this.gaiaAuthHost_.addEventListener( | 127 this.gaiaAuthHost_.addEventListener( |
127 'dialogShown', this.onDialogShown_.bind(this)); | 128 'dialogShown', this.onDialogShown_.bind(this)); |
128 this.gaiaAuthHost_.addEventListener( | 129 this.gaiaAuthHost_.addEventListener( |
129 'dialogHidden', this.onDialogHidden_.bind(this)); | 130 'dialogHidden', this.onDialogHidden_.bind(this)); |
130 this.gaiaAuthHost_.addEventListener( | 131 this.gaiaAuthHost_.addEventListener( |
131 'backButton', this.onBackButton_.bind(this)); | 132 'backButton', this.onBackButton_.bind(this)); |
132 this.gaiaAuthHost_.addEventListener( | 133 this.gaiaAuthHost_.addEventListener( |
133 'showView', this.onShowView_.bind(this)); | 134 'showView', this.onShowView_.bind(this)); |
135 this.gaiaAuthHost_.addEventListener('attemptLogin', | |
136 this.onAttemptLogin_.bind(this)); | |
134 this.gaiaAuthHost_.confirmPasswordCallback = | 137 this.gaiaAuthHost_.confirmPasswordCallback = |
135 this.onAuthConfirmPassword_.bind(this); | 138 this.onAuthConfirmPassword_.bind(this); |
136 this.gaiaAuthHost_.noPasswordCallback = | 139 this.gaiaAuthHost_.noPasswordCallback = |
137 this.onAuthNoPassword_.bind(this); | 140 this.onAuthNoPassword_.bind(this); |
138 this.gaiaAuthHost_.insecureContentBlockedCallback = | 141 this.gaiaAuthHost_.insecureContentBlockedCallback = |
139 this.onInsecureContentBlocked_.bind(this); | 142 this.onInsecureContentBlocked_.bind(this); |
140 this.gaiaAuthHost_.missingGaiaInfoCallback = | 143 this.gaiaAuthHost_.missingGaiaInfoCallback = |
141 this.missingGaiaInfo_.bind(this); | 144 this.missingGaiaInfo_.bind(this); |
142 this.gaiaAuthHost_.samlApiUsedCallback = | 145 this.gaiaAuthHost_.samlApiUsedCallback = |
143 this.samlApiUsed_.bind(this); | 146 this.samlApiUsed_.bind(this); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 | 543 |
541 /** | 544 /** |
542 * Invoked when the auth host emits 'showView' event. | 545 * Invoked when the auth host emits 'showView' event. |
543 * @private | 546 * @private |
544 */ | 547 */ |
545 onShowView_: function(e) { | 548 onShowView_: function(e) { |
546 $('signin-frame').classList.add('show'); | 549 $('signin-frame').classList.add('show'); |
547 }, | 550 }, |
548 | 551 |
549 /** | 552 /** |
553 * Invoked when the auth host emits 'attemptLogin' event. | |
Nikita (slow)
2015/04/22 16:51:52
nit: Add information about parameter.
Alexander Alekseev
2015/04/22 17:58:07
Done.
| |
554 * @private | |
555 */ | |
556 onAttemptLogin_: function(e) { | |
557 chrome.send('attemptLogin', [e.detail]); | |
558 }, | |
559 | |
560 /** | |
550 * Invoked when the user has successfully authenticated via SAML, the | 561 * Invoked when the user has successfully authenticated via SAML, the |
551 * principals API was not used and the auth host needs the user to confirm | 562 * principals API was not used and the auth host needs the user to confirm |
552 * the scraped password. | 563 * the scraped password. |
553 * @param {number} passwordCount The number of passwords that were scraped. | 564 * @param {number} passwordCount The number of passwords that were scraped. |
554 * @private | 565 * @private |
555 */ | 566 */ |
556 onAuthConfirmPassword_: function(passwordCount) { | 567 onAuthConfirmPassword_: function(passwordCount) { |
557 this.loading = true; | 568 this.loading = true; |
558 Oobe.getInstance().headerHidden = false; | 569 Oobe.getInstance().headerHidden = false; |
559 | 570 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
849 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : | 860 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : |
850 'whitelistErrorConsumer'); | 861 'whitelistErrorConsumer'); |
851 } | 862 } |
852 | 863 |
853 this.classList.toggle('whitelist-error', show); | 864 this.classList.toggle('whitelist-error', show); |
854 this.loading = !show; | 865 this.loading = !show; |
855 | 866 |
856 if (!show) | 867 if (!show) |
857 Oobe.showSigninUI(); | 868 Oobe.showSigninUI(); |
858 }, | 869 }, |
870 | |
871 /** | |
872 * Inform Gaia of new deviceId. | |
873 * @param {data} Object like {'deviceId': 'test-device-id'} | |
874 */ | |
875 updateDeviceId: function(data) { | |
876 if (!this.isNewGaiaFlow) | |
877 return; | |
878 | |
879 if (data && data.deviceId) | |
880 this.gaiaAuthHost_.updateDeviceId(data.deviceId); | |
881 }, | |
859 }; | 882 }; |
860 }); | 883 }); |
OLD | NEW |