diff options
Diffstat (limited to 'chromium/chrome/browser/resources/chromeos/login/header_bar.js')
-rw-r--r-- | chromium/chrome/browser/resources/chromeos/login/header_bar.js | 78 |
1 files changed, 65 insertions, 13 deletions
diff --git a/chromium/chrome/browser/resources/chromeos/login/header_bar.js b/chromium/chrome/browser/resources/chromeos/login/header_bar.js index 06e7434da36..fc22bbf3412 100644 --- a/chromium/chrome/browser/resources/chromeos/login/header_bar.js +++ b/chromium/chrome/browser/resources/chromeos/login/header_bar.js @@ -9,6 +9,7 @@ cr.define('login', function() { /** * Creates a header bar element. + * * @constructor * @extends {HTMLDivElement} */ @@ -45,12 +46,18 @@ cr.define('login', function() { $('cancel-multiple-sign-in-button').addEventListener('click', this.handleCancelMultipleSignInClick_); if (Oobe.getInstance().displayType == DISPLAY_TYPE.LOGIN || - Oobe.getInstance().displayType == DISPLAY_TYPE.OOBE) - login.AppsMenuButton.decorate($('show-apps-button')); + Oobe.getInstance().displayType == DISPLAY_TYPE.OOBE) { + if (Oobe.getInstance().newKioskUI) + chrome.send('initializeKioskApps'); + else + login.AppsMenuButton.decorate($('show-apps-button')); + } + this.updateUI_(); }, /** * Tab index value for all button elements. + * * @type {number} */ set buttonsTabIndex(tabIndex) { @@ -62,6 +69,7 @@ cr.define('login', function() { /** * Disables the header bar and all of its elements. + * * @type {boolean} */ set disabled(value) { @@ -73,6 +81,7 @@ cr.define('login', function() { /** * Add user button click handler. + * * @private */ handleAddUserClick_: function(e) { @@ -85,6 +94,7 @@ cr.define('login', function() { /** * Cancel add user button click handler. + * * @private */ handleCancelAddUserClick_: function(e) { @@ -103,6 +113,7 @@ cr.define('login', function() { /** * Guest button click handler. + * * @private */ handleGuestClick_: function(e) { @@ -113,6 +124,7 @@ cr.define('login', function() { /** * Sign out button click handler. + * * @private */ handleSignoutClick_: function(e) { @@ -123,6 +135,7 @@ cr.define('login', function() { /** * Shutdown button click handler. + * * @private */ handleShutdownClick_: function(e) { @@ -132,6 +145,7 @@ cr.define('login', function() { /** * Cancel user adding button handler. + * * @private */ handleCancelMultipleSignInClick_: function(e) { @@ -141,6 +155,7 @@ cr.define('login', function() { /** * If true then "Browse as Guest" button is shown. + * * @type {boolean} */ set showGuestButton(value) { @@ -149,10 +164,14 @@ cr.define('login', function() { }, /** - * Update current header bar UI. - * @type {number} state Current state of the sign-in screen - * (see SIGNIN_UI_STATE). + * Current header bar UI / sign in state. + * + * @type {number} state Current state of the sign-in screen (see + * SIGNIN_UI_STATE). */ + get signinUIState() { + return this.signinUIState_; + }, set signinUIState(state) { this.signinUIState_ = state; this.updateUI_(); @@ -160,6 +179,7 @@ cr.define('login', function() { /** * Whether the Cancel button is enabled during Gaia sign-in. + * * @type {boolean} */ set allowCancel(value) { @@ -169,6 +189,7 @@ cr.define('login', function() { /** * Update whether there are kiosk apps. + * * @type {boolean} */ set hasApps(value) { @@ -178,6 +199,7 @@ cr.define('login', function() { /** * Updates visibility state of action buttons. + * * @private */ updateUI_: function() { @@ -188,10 +210,15 @@ cr.define('login', function() { (this.signinUIState_ == SIGNIN_UI_STATE.MANAGED_USER_CREATION_FLOW); var wrongHWIDWarningIsActive = (this.signinUIState_ == SIGNIN_UI_STATE.WRONG_HWID_WARNING); + var isSamlPasswordConfirm = + (this.signinUIState_ == SIGNIN_UI_STATE.SAML_PASSWORD_CONFIRM); var isMultiProfilesUI = (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING); + var isLockScreen = + (Oobe.getInstance().displayType == DISPLAY_TYPE.LOCK); - $('add-user-button').hidden = !accountPickerIsActive || isMultiProfilesUI; + $('add-user-button').hidden = + !accountPickerIsActive || isMultiProfilesUI || isLockScreen; $('cancel-add-user-button').hidden = accountPickerIsActive || !this.allowCancel_ || wrongHWIDWarningIsActive || @@ -200,19 +227,25 @@ cr.define('login', function() { managedUserCreationDialogIsActive || !this.showGuest_ || wrongHWIDWarningIsActive || + isSamlPasswordConfirm || isMultiProfilesUI; + $('sign-out-user-item').hidden = !isLockScreen; + $('add-user-header-bar-item').hidden = $('add-user-button').hidden && $('cancel-add-user-button').hidden; $('apps-header-bar-item').hidden = !this.hasApps_ || (!gaiaIsActive && !accountPickerIsActive); $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI; - if (!$('apps-header-bar-item').hidden) - $('show-apps-button').didShow(); + if (!Oobe.getInstance().newKioskUI) { + if (!$('apps-header-bar-item').hidden) + $('show-apps-button').didShow(); + } }, /** * Animates Header bar to hide from the screen. + * * @param {function()} callback will be called once animation is finished. */ animateOut: function(callback) { @@ -232,10 +265,29 @@ cr.define('login', function() { /** * Animates Header bar to slowly appear on the screen. + * + * @param {function()} callback will be called once animation is finished. */ - animateIn: function() { - this.classList.remove('login-header-bar-animate-fast'); - this.classList.add('login-header-bar-animate-slow'); + animateIn: function(callback) { + if (callback) { + var launcher = this; + launcher.addEventListener( + 'webkitTransitionEnd', function f(e) { + launcher.removeEventListener('webkitTransitionEnd', f); + callback(); + }); + // Guard timer for 2 seconds + 200 ms + epsilon. + ensureTransitionEndEvent(launcher, 2250); + } + + if (Oobe.getInstance().displayType == DISPLAY_TYPE.OOBE) { + this.classList.remove('login-header-bar-animate-slow'); + this.classList.add('login-header-bar-animate-fast'); + } else { + this.classList.remove('login-header-bar-animate-fast'); + this.classList.add('login-header-bar-animate-slow'); + } + this.classList.remove('login-header-bar-hidden'); }, }; @@ -250,8 +302,8 @@ cr.define('login', function() { /** * Convenience wrapper of animateIn. */ - HeaderBar.animateIn = function() { - $('login-header-bar').animateIn(); + HeaderBar.animateIn = function(callback) { + $('login-header-bar').animateIn(callback); } return { |