| 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 return { | 19 return { |
| 20 EXTERNAL_API: [ | 20 EXTERNAL_API: [ |
| 21 'loadAuthExtension', | 21 'loadAuthExtension', |
| 22 'updateAuthExtension', | 22 'updateAuthExtension', |
| 23 'doReload', | 23 'doReload', |
| 24 'onFrameError', | 24 'onFrameError', |
| 25 'updateCancelButtonState', | 25 'updateCancelButtonState' |
| 26 'switchToFullTab' | |
| 27 ], | 26 ], |
| 28 | 27 |
| 29 /** | 28 /** |
| 30 * Frame loading error code (0 - no error). | 29 * Frame loading error code (0 - no error). |
| 31 * @type {number} | 30 * @type {number} |
| 32 * @private | 31 * @private |
| 33 */ | 32 */ |
| 34 error_: 0, | 33 error_: 0, |
| 35 | 34 |
| 36 /** | 35 /** |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 307 |
| 309 if (data.localizedStrings) | 308 if (data.localizedStrings) |
| 310 params.localizedStrings = data.localizedStrings; | 309 params.localizedStrings = data.localizedStrings; |
| 311 | 310 |
| 312 if (this.isMinuteMaid) { | 311 if (this.isMinuteMaid) { |
| 313 $('inner-container').classList.add('minute-maid'); | 312 $('inner-container').classList.add('minute-maid'); |
| 314 $('progress-dots').hidden = true; | 313 $('progress-dots').hidden = true; |
| 315 if (data.enterpriseDomain) | 314 if (data.enterpriseDomain) |
| 316 params.enterpriseDomain = data.enterpriseDomain; | 315 params.enterpriseDomain = data.enterpriseDomain; |
| 317 params.chromeType = data.chromeType; | 316 params.chromeType = data.chromeType; |
| 318 data.useEmbedded = false; | |
| 319 params.isMinuteMaidChromeOS = true; | 317 params.isMinuteMaidChromeOS = true; |
| 320 $('login-header-bar').showGuestButton = true; | 318 $('login-header-bar').showGuestButton = true; |
| 321 } | 319 } |
| 322 | 320 |
| 323 if (data.gaiaEndpoint) | 321 if (data.gaiaEndpoint) |
| 324 params.gaiaPath = data.gaiaEndpoint; | 322 params.gaiaPath = data.gaiaEndpoint; |
| 325 | 323 |
| 326 $('login-header-bar').minuteMaid = this.isMinuteMaid; | 324 $('login-header-bar').minuteMaid = this.isMinuteMaid; |
| 327 | 325 |
| 328 if (data.useEmbedded) | |
| 329 params.gaiaPath = 'EmbeddedSignIn'; | |
| 330 | |
| 331 if (data.forceReload || | 326 if (data.forceReload || |
| 332 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { | 327 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { |
| 333 this.error_ = 0; | 328 this.error_ = 0; |
| 334 | 329 |
| 335 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; | 330 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; |
| 336 if (data.useOffline) | 331 if (data.useOffline) |
| 337 authMode = cr.login.GaiaAuthHost.AuthMode.OFFLINE; | 332 authMode = cr.login.GaiaAuthHost.AuthMode.OFFLINE; |
| 338 else if (data.useEmbedded) | |
| 339 authMode = cr.login.GaiaAuthHost.AuthMode.DESKTOP; | |
| 340 | 333 |
| 341 this.gaiaAuthHost_.load(authMode, | 334 this.gaiaAuthHost_.load(authMode, |
| 342 params, | 335 params, |
| 343 this.onAuthCompleted_.bind(this)); | 336 this.onAuthCompleted_.bind(this)); |
| 344 this.gaiaAuthParams_ = params; | 337 this.gaiaAuthParams_ = params; |
| 345 | 338 |
| 346 this.loading = true; | 339 this.loading = true; |
| 347 this.startLoadingTimer_(); | 340 this.startLoadingTimer_(); |
| 348 } else if (this.loading && this.error_) { | 341 } else if (this.loading && this.error_) { |
| 349 // An error has occurred, so trying to reload. | 342 // An error has occurred, so trying to reload. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 * Updates [Cancel] button state. Allow cancellation of screen only when | 399 * Updates [Cancel] button state. Allow cancellation of screen only when |
| 407 * user pods can be displayed. | 400 * user pods can be displayed. |
| 408 */ | 401 */ |
| 409 updateCancelButtonState: function() { | 402 updateCancelButtonState: function() { |
| 410 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; | 403 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; |
| 411 $('login-header-bar').allowCancel = this.cancelAllowed_; | 404 $('login-header-bar').allowCancel = this.cancelAllowed_; |
| 412 if (this.isMinuteMaid) | 405 if (this.isMinuteMaid) |
| 413 $('close-button-item').hidden = !this.cancelAllowed_; | 406 $('close-button-item').hidden = !this.cancelAllowed_; |
| 414 }, | 407 }, |
| 415 | 408 |
| 416 switchToFullTab: function() { | |
| 417 this.classList.toggle('no-right-panel', true); | |
| 418 this.classList.toggle('full-width', true); | |
| 419 }, | |
| 420 | |
| 421 /** | 409 /** |
| 422 * Whether the current auth flow is SAML. | 410 * Whether the current auth flow is SAML. |
| 423 */ | 411 */ |
| 424 isSAML: function() { | 412 isSAML: function() { |
| 425 return this.gaiaAuthHost_.authFlow == | 413 return this.gaiaAuthHost_.authFlow == |
| 426 cr.login.GaiaAuthHost.AuthFlow.SAML; | 414 cr.login.GaiaAuthHost.AuthFlow.SAML; |
| 427 }, | 415 }, |
| 428 | 416 |
| 429 /** | 417 /** |
| 430 * Invoked when the authFlow property is changed no the gaia host. | 418 * Invoked when the authFlow property is changed no the gaia host. |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 * For more info see C++ class 'WebUILoginView' which calls this method. | 724 * For more info see C++ class 'WebUILoginView' which calls this method. |
| 737 * @param {number} error Error code. | 725 * @param {number} error Error code. |
| 738 * @param {string} url The URL that failed to load. | 726 * @param {string} url The URL that failed to load. |
| 739 */ | 727 */ |
| 740 onFrameError: function(error, url) { | 728 onFrameError: function(error, url) { |
| 741 this.error_ = error; | 729 this.error_ = error; |
| 742 chrome.send('frameLoadingCompleted', [this.error_]); | 730 chrome.send('frameLoadingCompleted', [this.error_]); |
| 743 }, | 731 }, |
| 744 }; | 732 }; |
| 745 }); | 733 }); |
| OLD | NEW |