Chromium Code Reviews| 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 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 /** @const */ var NET_ERROR_ABORTED = 3; | 21 /** @const */ var NET_ERROR_ABORTED = 3; |
| 22 | 22 |
| 23 /** @const */ var NET_ERROR_DISALLOWED_URL_SCHEME = 301; | 23 /** @const */ var NET_ERROR_DISALLOWED_URL_SCHEME = 301; |
| 24 | 24 |
| 25 return { | 25 return { |
| 26 EXTERNAL_API: [ | 26 EXTERNAL_API: [ |
| 27 'loadAuthExtension', | 27 'loadAuthExtension', |
| 28 'updateAuthExtension', | 28 'updateAuthExtension', |
| 29 'setAuthenticatedUserEmail', | 29 'setAuthenticatedUserEmail', |
| 30 'doReload', | 30 'doReload', |
| 31 'onFrameError' | 31 'onFrameError', |
| 32 'updateCancelButtonState' | |
| 32 ], | 33 ], |
| 33 | 34 |
| 34 /** | 35 /** |
| 35 * Frame loading error code (0 - no error). | 36 * Frame loading error code (0 - no error). |
| 36 * @type {number} | 37 * @type {number} |
| 37 * @private | 38 * @private |
| 38 */ | 39 */ |
| 39 error_: 0, | 40 error_: 0, |
| 40 | 41 |
| 41 /** | 42 /** |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 66 loadingTimer_: undefined, | 67 loadingTimer_: undefined, |
| 67 | 68 |
| 68 /** | 69 /** |
| 69 * Whether user can cancel Gaia screen. | 70 * Whether user can cancel Gaia screen. |
| 70 * @type {boolean} | 71 * @type {boolean} |
| 71 * @private | 72 * @private |
| 72 */ | 73 */ |
| 73 cancelAllowed_: undefined, | 74 cancelAllowed_: undefined, |
| 74 | 75 |
| 75 /** | 76 /** |
| 77 * Whether we should user pods on the login screen. | |
|
dzhioev (left Google)
2014/02/18 14:19:49
should show?
Nikita (slow)
2014/02/18 14:23:21
Done.
| |
| 78 * @type {boolean} | |
| 79 * @private | |
| 80 */ | |
| 81 isShowUsers_: undefined, | |
| 82 | |
| 83 /** | |
| 76 * SAML password confirmation attempt count. | 84 * SAML password confirmation attempt count. |
| 77 * @type {number} | 85 * @type {number} |
| 78 */ | 86 */ |
| 79 samlPasswordConfirmAttempt_: 0, | 87 samlPasswordConfirmAttempt_: 0, |
| 80 | 88 |
| 81 /** @override */ | 89 /** @override */ |
| 82 decorate: function() { | 90 decorate: function() { |
| 83 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); | 91 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); |
| 84 this.gaiaAuthHost_.addEventListener( | 92 this.gaiaAuthHost_.addEventListener( |
| 85 'ready', this.onAuthReady_.bind(this)); | 93 'ready', this.onAuthReady_.bind(this)); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 $('createAccount').hidden = !data.createAccount; | 298 $('createAccount').hidden = !data.createAccount; |
| 291 $('guestSignin').hidden = !data.guestSignin; | 299 $('guestSignin').hidden = !data.guestSignin; |
| 292 $('createManagedUserPane').hidden = !data.managedUsersEnabled; | 300 $('createManagedUserPane').hidden = !data.managedUsersEnabled; |
| 293 | 301 |
| 294 $('createManagedUserLinkPlaceholder').hidden = | 302 $('createManagedUserLinkPlaceholder').hidden = |
| 295 !data.managedUsersCanCreate; | 303 !data.managedUsersCanCreate; |
| 296 $('createManagedUserNoManagerText').hidden = data.managedUsersCanCreate; | 304 $('createManagedUserNoManagerText').hidden = data.managedUsersCanCreate; |
| 297 $('createManagedUserNoManagerText').textContent = | 305 $('createManagedUserNoManagerText').textContent = |
| 298 data.managedUsersRestrictionReason; | 306 data.managedUsersRestrictionReason; |
| 299 | 307 |
| 300 // Allow cancellation of screen only when user pods can be displayed. | 308 this.isShowUsers_ = data.isShowUsers; |
| 301 this.cancelAllowed_ = data.isShowUsers && $('pod-row').pods.length; | 309 this.updateCancelButtonState(); |
| 302 $('login-header-bar').allowCancel = this.cancelAllowed_; | |
| 303 | 310 |
| 304 // Sign-in right panel is hidden if all of its items are hidden. | 311 // Sign-in right panel is hidden if all of its items are hidden. |
| 305 var noRightPanel = $('gaia-signin-reason').hidden && | 312 var noRightPanel = $('gaia-signin-reason').hidden && |
| 306 $('createAccount').hidden && | 313 $('createAccount').hidden && |
| 307 $('guestSignin').hidden && | 314 $('guestSignin').hidden && |
| 308 $('createManagedUserPane').hidden; | 315 $('createManagedUserPane').hidden; |
| 309 this.classList.toggle('no-right-panel', noRightPanel); | 316 this.classList.toggle('no-right-panel', noRightPanel); |
| 310 if (Oobe.getInstance().currentScreen === this) | 317 if (Oobe.getInstance().currentScreen === this) |
| 311 Oobe.getInstance().updateScreenSize(this); | 318 Oobe.getInstance().updateScreenSize(this); |
| 312 }, | 319 }, |
| 313 | 320 |
| 314 /** | 321 /** |
| 315 * Sends the authenticated user's e-mail address to the auth extension. | 322 * Sends the authenticated user's e-mail address to the auth extension. |
| 316 * @param {number} attemptToken The opaque token provided to | 323 * @param {number} attemptToken The opaque token provided to |
| 317 * onRetrieveAuthenticatedUserEmail_. | 324 * onRetrieveAuthenticatedUserEmail_. |
| 318 * @param {string} email The authenticated user's e-mail address. | 325 * @param {string} email The authenticated user's e-mail address. |
| 319 */ | 326 */ |
| 320 setAuthenticatedUserEmail: function(attemptToken, email) { | 327 setAuthenticatedUserEmail: function(attemptToken, email) { |
| 321 this.gaiaAuthHost_.setAuthenticatedUserEmail(attemptToken, email); | 328 this.gaiaAuthHost_.setAuthenticatedUserEmail(attemptToken, email); |
| 322 }, | 329 }, |
| 323 | 330 |
| 324 /** | 331 /** |
| 332 * Updates [Cancel] button state. Allow cancellation of screen only when | |
| 333 * user pods can be displayed. | |
| 334 */ | |
| 335 updateCancelButtonState: function() { | |
| 336 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; | |
| 337 $('login-header-bar').allowCancel = this.cancelAllowed_; | |
| 338 }, | |
| 339 | |
| 340 /** | |
| 325 * Whether the current auth flow is SAML. | 341 * Whether the current auth flow is SAML. |
| 326 */ | 342 */ |
| 327 isSAML: function() { | 343 isSAML: function() { |
| 328 return this.gaiaAuthHost_.authFlow == | 344 return this.gaiaAuthHost_.authFlow == |
| 329 cr.login.GaiaAuthHost.AuthFlow.SAML; | 345 cr.login.GaiaAuthHost.AuthFlow.SAML; |
| 330 }, | 346 }, |
| 331 | 347 |
| 332 /** | 348 /** |
| 333 * Invoked when the authFlow property is changed no the gaia host. | 349 * Invoked when the authFlow property is changed no the gaia host. |
| 334 * @param {Event} e Property change event. | 350 * @param {Event} e Property change event. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 url.indexOf('http://') == 0 && | 618 url.indexOf('http://') == 0 && |
| 603 this.gaiaAuthParams_.gaiaUrl.indexOf('https://') == 0) { | 619 this.gaiaAuthParams_.gaiaUrl.indexOf('https://') == 0) { |
| 604 error = NET_ERROR_DISALLOWED_URL_SCHEME; | 620 error = NET_ERROR_DISALLOWED_URL_SCHEME; |
| 605 this.showFatalAuthError(); | 621 this.showFatalAuthError(); |
| 606 } | 622 } |
| 607 this.error_ = error; | 623 this.error_ = error; |
| 608 chrome.send('frameLoadingCompleted', [this.error_]); | 624 chrome.send('frameLoadingCompleted', [this.error_]); |
| 609 }, | 625 }, |
| 610 }; | 626 }; |
| 611 }); | 627 }); |
| OLD | NEW |