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 <include src="../../gaia_auth_host/gaia_auth_host.js"></include> | 9 <include src="../../gaia_auth_host/gaia_auth_host.js"></include> |
10 | 10 |
11 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { | 11 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
12 // Gaia loading time after which error message must be displayed and | 12 // Gaia loading time after which error message must be displayed and |
13 // lazy portal check should be fired. | 13 // lazy portal check should be fired. |
14 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; | 14 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; |
15 | 15 |
16 // Maximum Gaia loading time in seconds. | 16 // Maximum Gaia loading time in seconds. |
17 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; | 17 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; |
18 | 18 |
19 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; | 19 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; |
20 | 20 |
21 return { | 21 return { |
22 EXTERNAL_API: [ | 22 EXTERNAL_API: [ |
23 'loadAuthExtension', | 23 'loadAuthExtension', |
24 'updateAuthExtension', | 24 'updateAuthExtension', |
| 25 'setAuthenticatedUserEmail', |
25 'doReload', | 26 'doReload', |
26 'onFrameError' | 27 'onFrameError' |
27 ], | 28 ], |
28 | 29 |
29 /** | 30 /** |
30 * Frame loading error code (0 - no error). | 31 * Frame loading error code (0 - no error). |
31 * @type {number} | 32 * @type {number} |
32 * @private | 33 * @private |
33 */ | 34 */ |
34 error_: 0, | 35 error_: 0, |
(...skipping 30 matching lines...) Expand all Loading... |
65 * @type {boolean} | 66 * @type {boolean} |
66 * @private | 67 * @private |
67 */ | 68 */ |
68 cancelAllowed_: undefined, | 69 cancelAllowed_: undefined, |
69 | 70 |
70 /** @override */ | 71 /** @override */ |
71 decorate: function() { | 72 decorate: function() { |
72 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); | 73 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); |
73 this.gaiaAuthHost_.addEventListener( | 74 this.gaiaAuthHost_.addEventListener( |
74 'ready', this.onAuthReady_.bind(this)); | 75 'ready', this.onAuthReady_.bind(this)); |
| 76 this.gaiaAuthHost_.retrieveAuthenticatedUserEmailCallback = |
| 77 this.onRetrieveAuthenticatedUserEmail_.bind(this); |
75 this.gaiaAuthHost_.confirmPasswordCallback = | 78 this.gaiaAuthHost_.confirmPasswordCallback = |
76 this.onAuthConfirmPassword_.bind(this); | 79 this.onAuthConfirmPassword_.bind(this); |
77 this.gaiaAuthHost_.noPasswordCallback = | 80 this.gaiaAuthHost_.noPasswordCallback = |
78 this.onAuthNoPassword_.bind(this); | 81 this.onAuthNoPassword_.bind(this); |
79 this.gaiaAuthHost_.addEventListener('authFlowChange', | 82 this.gaiaAuthHost_.addEventListener('authFlowChange', |
80 this.onAuthFlowChange_.bind(this)); | 83 this.onAuthFlowChange_.bind(this)); |
81 | 84 |
82 $('enterprise-info-hint-link').addEventListener('click', function(e) { | 85 $('enterprise-info-hint-link').addEventListener('click', function(e) { |
83 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); | 86 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); |
84 e.preventDefault(); | 87 e.preventDefault(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 var noRightPanel = $('gaia-signin-reason').hidden && | 292 var noRightPanel = $('gaia-signin-reason').hidden && |
290 $('createAccount').hidden && | 293 $('createAccount').hidden && |
291 $('guestSignin').hidden && | 294 $('guestSignin').hidden && |
292 $('createManagedUserPane').hidden; | 295 $('createManagedUserPane').hidden; |
293 this.classList.toggle('no-right-panel', noRightPanel); | 296 this.classList.toggle('no-right-panel', noRightPanel); |
294 if (Oobe.getInstance().currentScreen === this) | 297 if (Oobe.getInstance().currentScreen === this) |
295 Oobe.getInstance().updateScreenSize(this); | 298 Oobe.getInstance().updateScreenSize(this); |
296 }, | 299 }, |
297 | 300 |
298 /** | 301 /** |
| 302 * Sends the authenticated user's e-mail address to the auth extension. |
| 303 * @param {number} attemptToken The opaque token provided to |
| 304 * onRetrieveAuthenticatedUserEmail_. |
| 305 * @param {string} email The authenticated user's e-mail address. |
| 306 */ |
| 307 setAuthenticatedUserEmail: function(attemptToken, email) { |
| 308 this.gaiaAuthHost_.setAuthenticatedUserEmail(attemptToken, email); |
| 309 }, |
| 310 |
| 311 /** |
299 * Whether the current auth flow is SAML. | 312 * Whether the current auth flow is SAML. |
300 */ | 313 */ |
301 isSAML: function() { | 314 isSAML: function() { |
302 return this.gaiaAuthHost_.authFlow == | 315 return this.gaiaAuthHost_.authFlow == |
303 cr.login.GaiaAuthHost.AuthFlow.SAML; | 316 cr.login.GaiaAuthHost.AuthFlow.SAML; |
304 }, | 317 }, |
305 | 318 |
306 /** | 319 /** |
307 * Invoked when the authFlow property is changed no the gaia host. | 320 * Invoked when the authFlow property is changed no the gaia host. |
308 * @param {Event} e Property change event. | 321 * @param {Event} e Property change event. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 353 } |
341 | 354 |
342 chrome.send('loginWebuiReady'); | 355 chrome.send('loginWebuiReady'); |
343 chrome.send('loginVisible', ['gaia-signin']); | 356 chrome.send('loginVisible', ['gaia-signin']); |
344 | 357 |
345 // Warm up the user images screen. | 358 // Warm up the user images screen. |
346 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); | 359 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); |
347 }, | 360 }, |
348 | 361 |
349 /** | 362 /** |
| 363 * Invoked when the auth host needs the authenticated user's e-mail to be |
| 364 * retrieved. |
| 365 * @param {number} attemptToken Opaque token to be passed to |
| 366 * setAuthenticatedUserEmail along with the e-mail address. |
| 367 * @private |
| 368 */ |
| 369 onRetrieveAuthenticatedUserEmail_: function(attemptToken) { |
| 370 chrome.send('retrieveAuthenticatedUserEmail', [attemptToken]); |
| 371 }, |
| 372 |
| 373 /** |
350 * Invoked when the auth host needs the user to confirm password. | 374 * Invoked when the auth host needs the user to confirm password. |
351 * @private | 375 * @private |
352 */ | 376 */ |
353 onAuthConfirmPassword_: function() { | 377 onAuthConfirmPassword_: function() { |
354 this.loading = true; | 378 this.loading = true; |
355 Oobe.getInstance().headerHidden = false; | 379 Oobe.getInstance().headerHidden = false; |
356 | 380 |
357 login.ConfirmPasswordScreen.show( | 381 login.ConfirmPasswordScreen.show( |
358 this.onConfirmPasswordCollected_.bind(this)); | 382 this.onConfirmPasswordCollected_.bind(this)); |
359 }, | 383 }, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 * Handler for iframe's error notification coming from the outside. | 545 * Handler for iframe's error notification coming from the outside. |
522 * For more info see C++ class 'SnifferObserver' which calls this method. | 546 * For more info see C++ class 'SnifferObserver' which calls this method. |
523 * @param {number} error Error code. | 547 * @param {number} error Error code. |
524 */ | 548 */ |
525 onFrameError: function(error) { | 549 onFrameError: function(error) { |
526 this.error_ = error; | 550 this.error_ = error; |
527 chrome.send('frameLoadingCompleted', [this.error_]); | 551 chrome.send('frameLoadingCompleted', [this.error_]); |
528 }, | 552 }, |
529 }; | 553 }; |
530 }); | 554 }); |
OLD | NEW |