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 30 matching lines...) Expand all Loading... |
41 gaiaAuthParams_: null, | 41 gaiaAuthParams_: null, |
42 | 42 |
43 /** | 43 /** |
44 * Whether local version of Gaia page is used. | 44 * Whether local version of Gaia page is used. |
45 * @type {boolean} | 45 * @type {boolean} |
46 * @private | 46 * @private |
47 */ | 47 */ |
48 isLocal_: false, | 48 isLocal_: false, |
49 | 49 |
50 /** | 50 /** |
| 51 * Whether MinuteMaid flow is active. |
| 52 * @type {boolean} |
| 53 */ |
| 54 isMinuteMaid: false, |
| 55 |
| 56 /** |
51 * Email of the user, which is logging in using offline mode. | 57 * Email of the user, which is logging in using offline mode. |
52 * @type {string} | 58 * @type {string} |
53 */ | 59 */ |
54 email: '', | 60 email: '', |
55 | 61 |
56 /** | 62 /** |
57 * Whether consumer management enrollment is in progress. | 63 * Whether consumer management enrollment is in progress. |
58 * @type {boolean} | 64 * @type {boolean} |
59 * @private | 65 * @private |
60 */ | 66 */ |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 this.gaiaAuthHost_.addEventListener('authFlowChange', | 137 this.gaiaAuthHost_.addEventListener('authFlowChange', |
132 this.onAuthFlowChange_.bind(this)); | 138 this.onAuthFlowChange_.bind(this)); |
133 this.gaiaAuthHost_.addEventListener('authCompleted', | 139 this.gaiaAuthHost_.addEventListener('authCompleted', |
134 this.onAuthCompletedMessage_.bind(this)); | 140 this.onAuthCompletedMessage_.bind(this)); |
135 | 141 |
136 $('enterprise-info-hint-link').addEventListener('click', function(e) { | 142 $('enterprise-info-hint-link').addEventListener('click', function(e) { |
137 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); | 143 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); |
138 e.preventDefault(); | 144 e.preventDefault(); |
139 }); | 145 }); |
140 | 146 |
| 147 $('close-button-item').addEventListener('click', function(e) { |
| 148 this.cancel(); |
| 149 e.preventDefault(); |
| 150 }.bind(this)); |
| 151 |
141 this.updateLocalizedContent(); | 152 this.updateLocalizedContent(); |
142 }, | 153 }, |
143 | 154 |
144 /** | 155 /** |
145 * Header text of the screen. | 156 * Header text of the screen. |
146 * @type {string} | 157 * @type {string} |
147 */ | 158 */ |
148 get header() { | 159 get header() { |
149 return loadTimeData.getString('signinScreenTitle'); | 160 return loadTimeData.getString('signinScreenTitle'); |
150 }, | 161 }, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 var params = {}; | 304 var params = {}; |
294 for (var i in cr.login.GaiaAuthHost.SUPPORTED_PARAMS) { | 305 for (var i in cr.login.GaiaAuthHost.SUPPORTED_PARAMS) { |
295 var name = cr.login.GaiaAuthHost.SUPPORTED_PARAMS[i]; | 306 var name = cr.login.GaiaAuthHost.SUPPORTED_PARAMS[i]; |
296 if (data[name]) | 307 if (data[name]) |
297 params[name] = data[name]; | 308 params[name] = data[name]; |
298 } | 309 } |
299 | 310 |
300 if (data.localizedStrings) | 311 if (data.localizedStrings) |
301 params.localizedStrings = data.localizedStrings; | 312 params.localizedStrings = data.localizedStrings; |
302 | 313 |
303 if (data.gaiaEndpoint) { | 314 if (data.useMinuteMaid) { |
| 315 this.isMinuteMaid = true; |
| 316 $('inner-container').classList.add('minute-maid'); |
| 317 $('progress-dots').hidden = true; |
304 data.useEmbedded = false; | 318 data.useEmbedded = false; |
| 319 $('login-header-bar').showGuestButton = true; |
| 320 } |
| 321 |
| 322 if (data.gaiaEndpoint) |
305 params.gaiaPath = data.gaiaEndpoint; | 323 params.gaiaPath = data.gaiaEndpoint; |
306 } | 324 |
| 325 $('login-header-bar').minuteMaid = this.isMinuteMaid; |
| 326 |
307 | 327 |
308 if (data.useEmbedded) | 328 if (data.useEmbedded) |
309 params.gaiaPath = 'EmbeddedSignIn'; | 329 params.gaiaPath = 'EmbeddedSignIn'; |
310 | 330 |
311 if (data.forceReload || | 331 if (data.forceReload || |
312 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { | 332 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { |
313 this.error_ = 0; | 333 this.error_ = 0; |
314 | 334 |
315 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; | 335 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; |
316 if (data.useOffline) | 336 if (data.useOffline) |
(...skipping 22 matching lines...) Expand all Loading... |
339 updateAuthExtension: function(data) { | 359 updateAuthExtension: function(data) { |
340 var reasonLabel = $('gaia-signin-reason'); | 360 var reasonLabel = $('gaia-signin-reason'); |
341 if (data.passwordChanged) { | 361 if (data.passwordChanged) { |
342 reasonLabel.textContent = | 362 reasonLabel.textContent = |
343 loadTimeData.getString('signinScreenPasswordChanged'); | 363 loadTimeData.getString('signinScreenPasswordChanged'); |
344 reasonLabel.hidden = false; | 364 reasonLabel.hidden = false; |
345 } else { | 365 } else { |
346 reasonLabel.hidden = true; | 366 reasonLabel.hidden = true; |
347 } | 367 } |
348 | 368 |
349 $('createAccount').hidden = !data.createAccount; | 369 if (this.isMinuteMaid) { |
350 $('guestSignin').hidden = !data.guestSignin; | 370 $('login-header-bar').showCreateSupervisedButton = |
351 $('createSupervisedUserPane').hidden = !data.supervisedUsersEnabled; | 371 data.supervisedUsersCanCreate; |
| 372 } else { |
| 373 $('createAccount').hidden = !data.createAccount; |
| 374 $('guestSignin').hidden = !data.guestSignin; |
| 375 $('createSupervisedUserPane').hidden = !data.supervisedUsersEnabled; |
352 | 376 |
353 $('createSupervisedUserLinkPlaceholder').hidden = | 377 $('createSupervisedUserLinkPlaceholder').hidden = |
354 !data.supervisedUsersCanCreate; | 378 !data.supervisedUsersCanCreate; |
355 $('createSupervisedUserNoManagerText').hidden = | 379 $('createSupervisedUserNoManagerText').hidden = |
356 data.supervisedUsersCanCreate; | 380 data.supervisedUsersCanCreate; |
357 $('createSupervisedUserNoManagerText').textContent = | 381 $('createSupervisedUserNoManagerText').textContent = |
358 data.supervisedUsersRestrictionReason; | 382 data.supervisedUsersRestrictionReason; |
| 383 } |
359 | 384 |
360 var isEnrollingConsumerManagement = data.isEnrollingConsumerManagement; | 385 var isEnrollingConsumerManagement = data.isEnrollingConsumerManagement; |
361 $('consumerManagementEnrollment').hidden = !isEnrollingConsumerManagement; | 386 $('consumerManagementEnrollment').hidden = !isEnrollingConsumerManagement; |
362 | 387 |
363 this.isShowUsers_ = data.isShowUsers; | 388 this.isShowUsers_ = data.isShowUsers; |
364 this.updateCancelButtonState(); | 389 this.updateCancelButtonState(); |
365 | 390 |
366 this.isEnrollingConsumerManagement_ = isEnrollingConsumerManagement; | 391 this.isEnrollingConsumerManagement_ = isEnrollingConsumerManagement; |
367 | 392 |
368 // Sign-in right panel is hidden if all of its items are hidden. | 393 // Sign-in right panel is hidden if all of its items are hidden. |
369 var noRightPanel = $('gaia-signin-reason').hidden && | 394 var noRightPanel = $('gaia-signin-reason').hidden && |
370 $('createAccount').hidden && | 395 $('createAccount').hidden && |
371 $('guestSignin').hidden && | 396 $('guestSignin').hidden && |
372 $('createSupervisedUserPane').hidden && | 397 $('createSupervisedUserPane').hidden && |
373 $('consumerManagementEnrollment').hidden; | 398 $('consumerManagementEnrollment').hidden; |
374 this.classList.toggle('no-right-panel', noRightPanel); | 399 this.classList.toggle('no-right-panel', noRightPanel); |
375 this.classList.toggle('full-width', false); | 400 this.classList.toggle('full-width', false); |
376 if (Oobe.getInstance().currentScreen === this) | 401 if (Oobe.getInstance().currentScreen === this) |
377 Oobe.getInstance().updateScreenSize(this); | 402 Oobe.getInstance().updateScreenSize(this); |
378 }, | 403 }, |
379 | 404 |
380 /** | 405 /** |
381 * Updates [Cancel] button state. Allow cancellation of screen only when | 406 * Updates [Cancel] button state. Allow cancellation of screen only when |
382 * user pods can be displayed. | 407 * user pods can be displayed. |
383 */ | 408 */ |
384 updateCancelButtonState: function() { | 409 updateCancelButtonState: function() { |
385 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; | 410 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; |
386 $('login-header-bar').allowCancel = this.cancelAllowed_; | 411 $('login-header-bar').allowCancel = this.cancelAllowed_; |
| 412 $('close-button-item').hidden = !this.cancelAllowed_; |
387 }, | 413 }, |
388 | 414 |
389 switchToFullTab: function() { | 415 switchToFullTab: function() { |
390 this.classList.toggle('no-right-panel', true); | 416 this.classList.toggle('no-right-panel', true); |
391 this.classList.toggle('full-width', true); | 417 this.classList.toggle('full-width', true); |
392 }, | 418 }, |
393 | 419 |
394 /** | 420 /** |
395 * Whether the current auth flow is SAML. | 421 * Whether the current auth flow is SAML. |
396 */ | 422 */ |
(...skipping 15 matching lines...) Expand all Loading... |
412 this.gaiaAuthHost_.authDomain); | 438 this.gaiaAuthHost_.authDomain); |
413 } | 439 } |
414 | 440 |
415 this.classList.toggle('no-right-panel', isSAML); | 441 this.classList.toggle('no-right-panel', isSAML); |
416 this.classList.toggle('full-width', isSAML); | 442 this.classList.toggle('full-width', isSAML); |
417 $('saml-notice-container').hidden = !isSAML; | 443 $('saml-notice-container').hidden = !isSAML; |
418 | 444 |
419 if (Oobe.getInstance().currentScreen === this) { | 445 if (Oobe.getInstance().currentScreen === this) { |
420 Oobe.getInstance().updateScreenSize(this); | 446 Oobe.getInstance().updateScreenSize(this); |
421 $('login-header-bar').allowCancel = isSAML || this.cancelAllowed_; | 447 $('login-header-bar').allowCancel = isSAML || this.cancelAllowed_; |
| 448 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_); |
422 } | 449 } |
423 }, | 450 }, |
424 | 451 |
425 /** | 452 /** |
426 * Invoked when the auth host emits 'ready' event. | 453 * Invoked when the auth host emits 'ready' event. |
427 * @private | 454 * @private |
428 */ | 455 */ |
429 onAuthReady_: function() { | 456 onAuthReady_: function() { |
430 this.loading = false; | 457 this.loading = false; |
431 if (this.isWebviewSignin && this.isShown_) | 458 if (this.isWebviewSignin && this.isShown_) |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 * For more info see C++ class 'WebUILoginView' which calls this method. | 714 * For more info see C++ class 'WebUILoginView' which calls this method. |
688 * @param {number} error Error code. | 715 * @param {number} error Error code. |
689 * @param {string} url The URL that failed to load. | 716 * @param {string} url The URL that failed to load. |
690 */ | 717 */ |
691 onFrameError: function(error, url) { | 718 onFrameError: function(error, url) { |
692 this.error_ = error; | 719 this.error_ = error; |
693 chrome.send('frameLoadingCompleted', [this.error_]); | 720 chrome.send('frameLoadingCompleted', [this.error_]); |
694 }, | 721 }, |
695 }; | 722 }; |
696 }); | 723 }); |
OLD | NEW |