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 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 29 matching lines...) Expand all Loading... | |
| 40 gaiaAuthParams_: null, | 40 gaiaAuthParams_: null, |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * Whether local version of Gaia page is used. | 43 * Whether local version of Gaia page is used. |
| 44 * @type {boolean} | 44 * @type {boolean} |
| 45 * @private | 45 * @private |
| 46 */ | 46 */ |
| 47 isLocal_: false, | 47 isLocal_: false, |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Whether MinuteMaid flow is active. | 50 * Whether MinuteMaid flow is active. |
|
Nikita (slow)
2015/03/24 14:33:11
nit: remove MM
| |
| 51 * @type {boolean} | 51 * @type {boolean} |
| 52 */ | 52 */ |
| 53 isMinuteMaid: false, | 53 isNewGaiaFlow: false, |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Email of the user, which is logging in using offline mode. | 56 * Email of the user, which is logging in using offline mode. |
| 57 * @type {string} | 57 * @type {string} |
| 58 */ | 58 */ |
| 59 email: '', | 59 email: '', |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Whether consumer management enrollment is in progress. | 62 * Whether consumer management enrollment is in progress. |
| 63 * @type {boolean} | 63 * @type {boolean} |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 }, | 292 }, |
| 293 | 293 |
| 294 /** | 294 /** |
| 295 * Loads the authentication extension into the iframe. | 295 * Loads the authentication extension into the iframe. |
| 296 * @param {Object} data Extension parameters bag. | 296 * @param {Object} data Extension parameters bag. |
| 297 * @private | 297 * @private |
| 298 */ | 298 */ |
| 299 loadAuthExtension: function(data) { | 299 loadAuthExtension: function(data) { |
| 300 this.isLocal = data.isLocal; | 300 this.isLocal = data.isLocal; |
| 301 this.email = ''; | 301 this.email = ''; |
| 302 this.isMinuteMaid = data.useMinuteMaid; | 302 this.isNewGaiaFlow = data.useNewGaiaFlow; |
| 303 | 303 |
| 304 // Reset SAML | 304 // Reset SAML |
| 305 this.classList.toggle('full-width', false); | 305 this.classList.toggle('full-width', false); |
| 306 this.samlPasswordConfirmAttempt_ = 0; | 306 this.samlPasswordConfirmAttempt_ = 0; |
| 307 | 307 |
| 308 this.updateAuthExtension(data); | 308 this.updateAuthExtension(data); |
| 309 | 309 |
| 310 var params = {}; | 310 var params = {}; |
| 311 for (var i in cr.login.GaiaAuthHost.SUPPORTED_PARAMS) { | 311 for (var i in cr.login.GaiaAuthHost.SUPPORTED_PARAMS) { |
| 312 var name = cr.login.GaiaAuthHost.SUPPORTED_PARAMS[i]; | 312 var name = cr.login.GaiaAuthHost.SUPPORTED_PARAMS[i]; |
| 313 if (data[name]) | 313 if (data[name]) |
| 314 params[name] = data[name]; | 314 params[name] = data[name]; |
| 315 } | 315 } |
| 316 | 316 |
| 317 if (data.localizedStrings) | 317 if (data.localizedStrings) |
| 318 params.localizedStrings = data.localizedStrings; | 318 params.localizedStrings = data.localizedStrings; |
| 319 | 319 |
| 320 if (this.isMinuteMaid) { | 320 if (this.isNewGaiaFlow) { |
| 321 $('inner-container').classList.add('minute-maid'); | 321 $('inner-container').classList.add('minute-maid'); |
| 322 $('progress-dots').hidden = true; | 322 $('progress-dots').hidden = true; |
| 323 if (data.enterpriseDomain) | 323 if (data.enterpriseDomain) |
| 324 params.enterpriseDomain = data.enterpriseDomain; | 324 params.enterpriseDomain = data.enterpriseDomain; |
| 325 params.chromeType = data.chromeType; | 325 params.chromeType = data.chromeType; |
| 326 params.isMinuteMaidChromeOS = true; | 326 params.isNewGaiaFlowChromeOS = true; |
| 327 $('login-header-bar').showGuestButton = true; | 327 $('login-header-bar').showGuestButton = true; |
| 328 } | 328 } |
| 329 | 329 |
| 330 if (data.gaiaEndpoint) | 330 if (data.gaiaEndpoint) |
| 331 params.gaiaPath = data.gaiaEndpoint; | 331 params.gaiaPath = data.gaiaEndpoint; |
| 332 | 332 |
| 333 $('login-header-bar').minuteMaid = this.isMinuteMaid; | 333 $('login-header-bar').newGaiaFlow = this.isNewGaiaFlow; |
| 334 | 334 |
| 335 if (data.forceReload || | 335 if (data.forceReload || |
| 336 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { | 336 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { |
| 337 this.error_ = 0; | 337 this.error_ = 0; |
| 338 | 338 |
| 339 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; | 339 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; |
| 340 if (data.useOffline) | 340 if (data.useOffline) |
| 341 authMode = cr.login.GaiaAuthHost.AuthMode.OFFLINE; | 341 authMode = cr.login.GaiaAuthHost.AuthMode.OFFLINE; |
| 342 | 342 |
| 343 this.gaiaAuthHost_.load(authMode, | 343 this.gaiaAuthHost_.load(authMode, |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 361 updateAuthExtension: function(data) { | 361 updateAuthExtension: function(data) { |
| 362 var reasonLabel = $('gaia-signin-reason'); | 362 var reasonLabel = $('gaia-signin-reason'); |
| 363 if (data.passwordChanged) { | 363 if (data.passwordChanged) { |
| 364 reasonLabel.textContent = | 364 reasonLabel.textContent = |
| 365 loadTimeData.getString('signinScreenPasswordChanged'); | 365 loadTimeData.getString('signinScreenPasswordChanged'); |
| 366 reasonLabel.hidden = false; | 366 reasonLabel.hidden = false; |
| 367 } else { | 367 } else { |
| 368 reasonLabel.hidden = true; | 368 reasonLabel.hidden = true; |
| 369 } | 369 } |
| 370 | 370 |
| 371 if (this.isMinuteMaid) { | 371 if (this.isNewGaiaFlow) { |
| 372 $('login-header-bar').showCreateSupervisedButton = | 372 $('login-header-bar').showCreateSupervisedButton = |
| 373 data.supervisedUsersCanCreate; | 373 data.supervisedUsersCanCreate; |
| 374 } else { | 374 } else { |
| 375 $('createAccount').hidden = !data.createAccount; | 375 $('createAccount').hidden = !data.createAccount; |
| 376 $('guestSignin').hidden = !data.guestSignin; | 376 $('guestSignin').hidden = !data.guestSignin; |
| 377 $('createSupervisedUserPane').hidden = !data.supervisedUsersEnabled; | 377 $('createSupervisedUserPane').hidden = !data.supervisedUsersEnabled; |
| 378 | 378 |
| 379 $('createSupervisedUserLinkPlaceholder').hidden = | 379 $('createSupervisedUserLinkPlaceholder').hidden = |
| 380 !data.supervisedUsersCanCreate; | 380 !data.supervisedUsersCanCreate; |
| 381 $('createSupervisedUserNoManagerText').hidden = | 381 $('createSupervisedUserNoManagerText').hidden = |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 404 Oobe.getInstance().updateScreenSize(this); | 404 Oobe.getInstance().updateScreenSize(this); |
| 405 }, | 405 }, |
| 406 | 406 |
| 407 /** | 407 /** |
| 408 * Updates [Cancel] button state. Allow cancellation of screen only when | 408 * Updates [Cancel] button state. Allow cancellation of screen only when |
| 409 * user pods can be displayed. | 409 * user pods can be displayed. |
| 410 */ | 410 */ |
| 411 updateCancelButtonState: function() { | 411 updateCancelButtonState: function() { |
| 412 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; | 412 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; |
| 413 $('login-header-bar').allowCancel = this.cancelAllowed_; | 413 $('login-header-bar').allowCancel = this.cancelAllowed_; |
| 414 if (this.isMinuteMaid) | 414 if (this.isNewGaiaFlow) |
| 415 $('close-button-item').hidden = !this.cancelAllowed_; | 415 $('close-button-item').hidden = !this.cancelAllowed_; |
| 416 }, | 416 }, |
| 417 | 417 |
| 418 /** | 418 /** |
| 419 * Whether the current auth flow is SAML. | 419 * Whether the current auth flow is SAML. |
| 420 */ | 420 */ |
| 421 isSAML: function() { | 421 isSAML: function() { |
| 422 return this.gaiaAuthHost_.authFlow == | 422 return this.gaiaAuthHost_.authFlow == |
| 423 cr.login.GaiaAuthHost.AuthFlow.SAML; | 423 cr.login.GaiaAuthHost.AuthFlow.SAML; |
| 424 }, | 424 }, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 436 this.gaiaAuthHost_.authDomain); | 436 this.gaiaAuthHost_.authDomain); |
| 437 } | 437 } |
| 438 | 438 |
| 439 this.classList.toggle('no-right-panel', isSAML); | 439 this.classList.toggle('no-right-panel', isSAML); |
| 440 this.classList.toggle('full-width', isSAML); | 440 this.classList.toggle('full-width', isSAML); |
| 441 $('saml-notice-container').hidden = !isSAML; | 441 $('saml-notice-container').hidden = !isSAML; |
| 442 | 442 |
| 443 if (Oobe.getInstance().currentScreen === this) { | 443 if (Oobe.getInstance().currentScreen === this) { |
| 444 Oobe.getInstance().updateScreenSize(this); | 444 Oobe.getInstance().updateScreenSize(this); |
| 445 $('login-header-bar').allowCancel = isSAML || this.cancelAllowed_; | 445 $('login-header-bar').allowCancel = isSAML || this.cancelAllowed_; |
| 446 if (this.isMinuteMaid) | 446 if (this.isNewGaiaFlow) |
| 447 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_); | 447 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_); |
| 448 } | 448 } |
| 449 }, | 449 }, |
| 450 | 450 |
| 451 /** | 451 /** |
| 452 * Invoked when the auth host emits 'ready' event. | 452 * Invoked when the auth host emits 'ready' event. |
| 453 * @private | 453 * @private |
| 454 */ | 454 */ |
| 455 onAuthReady_: function() { | 455 onAuthReady_: function() { |
| 456 this.loading = false; | 456 this.loading = false; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 * For more info see C++ class 'WebUILoginView' which calls this method. | 743 * For more info see C++ class 'WebUILoginView' which calls this method. |
| 744 * @param {number} error Error code. | 744 * @param {number} error Error code. |
| 745 * @param {string} url The URL that failed to load. | 745 * @param {string} url The URL that failed to load. |
| 746 */ | 746 */ |
| 747 onFrameError: function(error, url) { | 747 onFrameError: function(error, url) { |
| 748 this.error_ = error; | 748 this.error_ = error; |
| 749 chrome.send('frameLoadingCompleted', [this.error_]); | 749 chrome.send('frameLoadingCompleted', [this.error_]); |
| 750 }, | 750 }, |
| 751 }; | 751 }; |
| 752 }); | 752 }); |
| OLD | NEW |