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"> | 9 <include src="../../gaia_auth_host/gaia_auth_host.js"> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 */ | 49 */ |
| 50 isLocal_: false, | 50 isLocal_: false, |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Email of the user, which is logging in using offline mode. | 53 * Email of the user, which is logging in using offline mode. |
| 54 * @type {string} | 54 * @type {string} |
| 55 */ | 55 */ |
| 56 email: '', | 56 email: '', |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Whether consumer management enrollment is in progress. | |
| 60 * @type {boolean} | |
| 61 * @private | |
| 62 */ | |
| 63 isEnrollingConsumerManagement_: false, | |
| 64 | |
| 65 /** | |
| 59 * Timer id of pending load. | 66 * Timer id of pending load. |
| 60 * @type {number} | 67 * @type {number} |
| 61 * @private | 68 * @private |
| 62 */ | 69 */ |
| 63 loadingTimer_: undefined, | 70 loadingTimer_: undefined, |
| 64 | 71 |
| 65 /** | 72 /** |
| 66 * Whether user can cancel Gaia screen. | 73 * Whether user can cancel Gaia screen. |
| 67 * @type {boolean} | 74 * @type {boolean} |
| 68 * @private | 75 * @private |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 this.showLoadingUI_(loading); | 211 this.showLoadingUI_(loading); |
| 205 }, | 212 }, |
| 206 | 213 |
| 207 /** | 214 /** |
| 208 * Event handler that is invoked just before the frame is shown. | 215 * Event handler that is invoked just before the frame is shown. |
| 209 * @param {string} data Screen init payload. Url of auth extension start | 216 * @param {string} data Screen init payload. Url of auth extension start |
| 210 * page. | 217 * page. |
| 211 */ | 218 */ |
| 212 onBeforeShow: function(data) { | 219 onBeforeShow: function(data) { |
| 213 chrome.send('loginUIStateChanged', ['gaia-signin', true]); | 220 chrome.send('loginUIStateChanged', ['gaia-signin', true]); |
| 214 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.GAIA_SIGNIN; | 221 $('login-header-bar').signinUIState = |
| 222 this.isEnrollingConsumerManagement_ ? | |
| 223 SIGNIN_UI_STATE.CONSUMER_MANAGEMENT_ENROLLMENT : | |
|
bartfab (slow)
2014/08/04 17:40:52
Nit: Indent this line and the next by four more sp
davidyu
2014/08/05 07:24:05
Done.
| |
| 224 SIGNIN_UI_STATE.GAIA_SIGNIN; | |
| 215 | 225 |
| 216 // Ensure that GAIA signin (or loading UI) is actually visible. | 226 // Ensure that GAIA signin (or loading UI) is actually visible. |
| 217 window.webkitRequestAnimationFrame(function() { | 227 window.webkitRequestAnimationFrame(function() { |
| 218 chrome.send('loginVisible', ['gaia-loading']); | 228 chrome.send('loginVisible', ['gaia-loading']); |
| 219 }); | 229 }); |
| 220 | 230 |
| 221 // Button header is always visible when sign in is presented. | 231 // Button header is always visible when sign in is presented. |
| 222 // Header is hidden once GAIA reports on successful sign in. | 232 // Header is hidden once GAIA reports on successful sign in. |
| 223 Oobe.getInstance().headerHidden = false; | 233 Oobe.getInstance().headerHidden = false; |
| 224 }, | 234 }, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 $('guestSignin').hidden = !data.guestSignin; | 311 $('guestSignin').hidden = !data.guestSignin; |
| 302 $('createSupervisedUserPane').hidden = !data.supervisedUsersEnabled; | 312 $('createSupervisedUserPane').hidden = !data.supervisedUsersEnabled; |
| 303 | 313 |
| 304 $('createSupervisedUserLinkPlaceholder').hidden = | 314 $('createSupervisedUserLinkPlaceholder').hidden = |
| 305 !data.supervisedUsersCanCreate; | 315 !data.supervisedUsersCanCreate; |
| 306 $('createSupervisedUserNoManagerText').hidden = | 316 $('createSupervisedUserNoManagerText').hidden = |
| 307 data.supervisedUsersCanCreate; | 317 data.supervisedUsersCanCreate; |
| 308 $('createSupervisedUserNoManagerText').textContent = | 318 $('createSupervisedUserNoManagerText').textContent = |
| 309 data.supervisedUsersRestrictionReason; | 319 data.supervisedUsersRestrictionReason; |
| 310 | 320 |
| 321 $('consumerManagementEnrollment').hidden = | |
| 322 !data.isEnrollingConsumerManagement; | |
| 323 | |
| 311 this.isShowUsers_ = data.isShowUsers; | 324 this.isShowUsers_ = data.isShowUsers; |
| 312 this.updateCancelButtonState(); | 325 this.updateCancelButtonState(); |
| 313 | 326 |
| 327 this.isEnrollingConsumerManagement_ = data.isEnrollingConsumerManagement; | |
|
bartfab (slow)
2014/08/04 17:40:52
Nit: You use |data.isEnrollingConsumerManagement|
davidyu
2014/08/05 07:24:05
Done.
| |
| 328 | |
| 314 // Sign-in right panel is hidden if all of its items are hidden. | 329 // Sign-in right panel is hidden if all of its items are hidden. |
| 315 var noRightPanel = $('gaia-signin-reason').hidden && | 330 var noRightPanel = $('gaia-signin-reason').hidden && |
| 316 $('createAccount').hidden && | 331 $('createAccount').hidden && |
| 317 $('guestSignin').hidden && | 332 $('guestSignin').hidden && |
| 318 $('createSupervisedUserPane').hidden; | 333 $('createSupervisedUserPane').hidden && |
| 334 $('consumerManagementEnrollment').hidden; | |
| 319 this.classList.toggle('no-right-panel', noRightPanel); | 335 this.classList.toggle('no-right-panel', noRightPanel); |
| 320 if (Oobe.getInstance().currentScreen === this) | 336 if (Oobe.getInstance().currentScreen === this) |
| 321 Oobe.getInstance().updateScreenSize(this); | 337 Oobe.getInstance().updateScreenSize(this); |
| 322 }, | 338 }, |
| 323 | 339 |
| 324 /** | 340 /** |
| 325 * Sends the authenticated user's e-mail address to the auth extension. | 341 * Sends the authenticated user's e-mail address to the auth extension. |
| 326 * @param {number} attemptToken The opaque token provided to | 342 * @param {number} attemptToken The opaque token provided to |
| 327 * onRetrieveAuthenticatedUserEmail_. | 343 * onRetrieveAuthenticatedUserEmail_. |
| 328 * @param {string} email The authenticated user's e-mail address. | 344 * @param {string} email The authenticated user's e-mail address. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 '</a>'); | 572 '</a>'); |
| 557 $('guestSignin').innerHTML = loadTimeData.getStringF( | 573 $('guestSignin').innerHTML = loadTimeData.getStringF( |
| 558 'guestSignin', | 574 'guestSignin', |
| 559 '<a id="guestSigninLink" class="signin-link" href="#">', | 575 '<a id="guestSigninLink" class="signin-link" href="#">', |
| 560 '</a>'); | 576 '</a>'); |
| 561 $('createSupervisedUserLinkPlaceholder').innerHTML = | 577 $('createSupervisedUserLinkPlaceholder').innerHTML = |
| 562 loadTimeData.getStringF( | 578 loadTimeData.getStringF( |
| 563 'createSupervisedUser', | 579 'createSupervisedUser', |
| 564 '<a id="createSupervisedUserLink" class="signin-link" href="#">', | 580 '<a id="createSupervisedUserLink" class="signin-link" href="#">', |
| 565 '</a>'); | 581 '</a>'); |
| 582 $('consumerManagementEnrollment').innerHTML = loadTimeData.getString( | |
| 583 'consumerManagementEnrollmentSigninMessage'); | |
| 566 $('createAccountLink').addEventListener('click', function(e) { | 584 $('createAccountLink').addEventListener('click', function(e) { |
| 567 chrome.send('createAccount'); | 585 chrome.send('createAccount'); |
| 568 e.preventDefault(); | 586 e.preventDefault(); |
| 569 }); | 587 }); |
| 570 $('guestSigninLink').addEventListener('click', function(e) { | 588 $('guestSigninLink').addEventListener('click', function(e) { |
| 571 chrome.send('launchIncognito'); | 589 chrome.send('launchIncognito'); |
| 572 e.preventDefault(); | 590 e.preventDefault(); |
| 573 }); | 591 }); |
| 574 $('createSupervisedUserLink').addEventListener('click', function(e) { | 592 $('createSupervisedUserLink').addEventListener('click', function(e) { |
| 575 chrome.send('showSupervisedUserCreationScreen'); | 593 chrome.send('showSupervisedUserCreationScreen'); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 * For more info see C++ class 'WebUILoginView' which calls this method. | 648 * For more info see C++ class 'WebUILoginView' which calls this method. |
| 631 * @param {number} error Error code. | 649 * @param {number} error Error code. |
| 632 * @param {string} url The URL that failed to load. | 650 * @param {string} url The URL that failed to load. |
| 633 */ | 651 */ |
| 634 onFrameError: function(error, url) { | 652 onFrameError: function(error, url) { |
| 635 this.error_ = error; | 653 this.error_ = error; |
| 636 chrome.send('frameLoadingCompleted', [this.error_]); | 654 chrome.send('frameLoadingCompleted', [this.error_]); |
| 637 }, | 655 }, |
| 638 }; | 656 }; |
| 639 }); | 657 }); |
| OLD | NEW |