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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 params.localizedStrings = data.localizedStrings; | 358 params.localizedStrings = data.localizedStrings; |
356 | 359 |
357 if (this.isNewGaiaFlow) { | 360 if (this.isNewGaiaFlow) { |
358 $('inner-container').classList.add('new-gaia-flow'); | 361 $('inner-container').classList.add('new-gaia-flow'); |
359 $('progress-dots').hidden = true; | 362 $('progress-dots').hidden = true; |
360 if (data.enterpriseDomain) | 363 if (data.enterpriseDomain) |
361 params.enterpriseDomain = data.enterpriseDomain; | 364 params.enterpriseDomain = data.enterpriseDomain; |
362 params.chromeType = data.chromeType; | 365 params.chromeType = data.chromeType; |
363 params.isNewGaiaFlowChromeOS = true; | 366 params.isNewGaiaFlowChromeOS = true; |
364 $('login-header-bar').showGuestButton = true; | 367 $('login-header-bar').showGuestButton = true; |
365 this.gaiaAuthHost_.setDeviceId(data.deviceId); | 368 params.deviceId = data.deviceId; |
366 } | 369 } |
367 | 370 |
368 if (data.gaiaEndpoint) | 371 if (data.gaiaEndpoint) |
369 params.gaiaPath = data.gaiaEndpoint; | 372 params.gaiaPath = data.gaiaEndpoint; |
370 | 373 |
371 $('login-header-bar').newGaiaFlow = this.isNewGaiaFlow; | 374 $('login-header-bar').newGaiaFlow = this.isNewGaiaFlow; |
372 | 375 |
373 if (data.forceReload || | 376 if (data.forceReload || |
374 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { | 377 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { |
375 this.error_ = 0; | 378 this.error_ = 0; |
(...skipping 164 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. |
| 554 * @param {Object} Message object with |detail| field keeping email: |
| 555 * like {detail: 'user@gmail.com'} . |
| 556 * @private |
| 557 */ |
| 558 onAttemptLogin_: function(e) { |
| 559 chrome.send('attemptLogin', [e.detail]); |
| 560 }, |
| 561 |
| 562 /** |
550 * Invoked when the user has successfully authenticated via SAML, the | 563 * 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 | 564 * principals API was not used and the auth host needs the user to confirm |
552 * the scraped password. | 565 * the scraped password. |
553 * @param {number} passwordCount The number of passwords that were scraped. | 566 * @param {number} passwordCount The number of passwords that were scraped. |
554 * @private | 567 * @private |
555 */ | 568 */ |
556 onAuthConfirmPassword_: function(passwordCount) { | 569 onAuthConfirmPassword_: function(passwordCount) { |
557 this.loading = true; | 570 this.loading = true; |
558 Oobe.getInstance().headerHidden = false; | 571 Oobe.getInstance().headerHidden = false; |
559 | 572 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : | 862 loadTimeData.getValue(isManaged ? 'whitelistErrorEnterprise' : |
850 'whitelistErrorConsumer'); | 863 'whitelistErrorConsumer'); |
851 } | 864 } |
852 | 865 |
853 this.classList.toggle('whitelist-error', show); | 866 this.classList.toggle('whitelist-error', show); |
854 this.loading = !show; | 867 this.loading = !show; |
855 | 868 |
856 if (!show) | 869 if (!show) |
857 Oobe.showSigninUI(); | 870 Oobe.showSigninUI(); |
858 }, | 871 }, |
| 872 |
| 873 /** |
| 874 * Inform Gaia of new deviceId. |
| 875 * @param {data} Object like {'deviceId': 'test-device-id'} |
| 876 */ |
| 877 updateDeviceId: function(data) { |
| 878 if (!this.isNewGaiaFlow) |
| 879 return; |
| 880 |
| 881 if (data && data.deviceId) |
| 882 this.gaiaAuthHost_.updateDeviceId(data.deviceId); |
| 883 }, |
859 }; | 884 }; |
860 }); | 885 }); |
OLD | NEW |