| 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 Login UI header bar implementation. | 6 * @fileoverview Login UI header bar implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('login', function() { | 9 cr.define('login', function() { |
| 10 /** | 10 /** |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 $('guest-user-header-bar-item').addEventListener('click', | 57 $('guest-user-header-bar-item').addEventListener('click', |
| 58 this.handleGuestClick_); | 58 this.handleGuestClick_); |
| 59 $('guest-user-button').addEventListener('click', | 59 $('guest-user-button').addEventListener('click', |
| 60 this.handleGuestClick_); | 60 this.handleGuestClick_); |
| 61 $('sign-out-user-button').addEventListener('click', | 61 $('sign-out-user-button').addEventListener('click', |
| 62 this.handleSignoutClick_); | 62 this.handleSignoutClick_); |
| 63 $('cancel-multiple-sign-in-button').addEventListener('click', | 63 $('cancel-multiple-sign-in-button').addEventListener('click', |
| 64 this.handleCancelMultipleSignInClick_); | 64 this.handleCancelMultipleSignInClick_); |
| 65 this.addSupervisedUserMenu.addEventListener('click', | 65 this.addSupervisedUserMenu.addEventListener('click', |
| 66 this.handleAddSupervisedUserClick_.bind(this)); | 66 this.handleAddSupervisedUserClick_.bind(this)); |
| 67 this.addSupervisedUserMenu.addEventListener('keydown', |
| 68 this.handleAddSupervisedUserKeyDown_.bind(this)); |
| 67 if (Oobe.getInstance().displayType == DISPLAY_TYPE.LOGIN || | 69 if (Oobe.getInstance().displayType == DISPLAY_TYPE.LOGIN || |
| 68 Oobe.getInstance().displayType == DISPLAY_TYPE.OOBE) { | 70 Oobe.getInstance().displayType == DISPLAY_TYPE.OOBE) { |
| 69 if (Oobe.getInstance().newKioskUI) | 71 if (Oobe.getInstance().newKioskUI) |
| 70 chrome.send('initializeKioskApps'); | 72 chrome.send('initializeKioskApps'); |
| 71 else | 73 else |
| 72 login.AppsMenuButton.decorate($('show-apps-button')); | 74 login.AppsMenuButton.decorate($('show-apps-button')); |
| 73 } | 75 } |
| 74 this.updateUI_(); | 76 this.updateUI_(); |
| 75 }, | 77 }, |
| 76 | 78 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 /** | 111 /** |
| 110 * Whether action box button is in active state. | 112 * Whether action box button is in active state. |
| 111 * @type {boolean} | 113 * @type {boolean} |
| 112 */ | 114 */ |
| 113 get isMoreSettingsActive() { | 115 get isMoreSettingsActive() { |
| 114 return this.getMoreSettingsMenu.classList.contains('active'); | 116 return this.getMoreSettingsMenu.classList.contains('active'); |
| 115 }, | 117 }, |
| 116 set isMoreSettingsActive(active) { | 118 set isMoreSettingsActive(active) { |
| 117 if (active == this.isMoreSettingsActive) | 119 if (active == this.isMoreSettingsActive) |
| 118 return; | 120 return; |
| 119 if (active) { | 121 this.getMoreSettingsMenu.classList.toggle('active', active); |
| 120 this.getMoreSettingsMenu.classList.add('active'); | 122 $('more-settings-button').tabIndex = active ? -1 : 0; |
| 121 } else { | |
| 122 this.getMoreSettingsMenu.classList.remove('active'); | |
| 123 } | |
| 124 }, | 123 }, |
| 125 | 124 |
| 126 | |
| 127 /** | 125 /** |
| 128 * Add user button click handler. | 126 * Add user button click handler. |
| 129 * | 127 * |
| 130 * @private | 128 * @private |
| 131 */ | 129 */ |
| 132 handleAddUserClick_: function(e) { | 130 handleAddUserClick_: function(e) { |
| 133 Oobe.showSigninUI(); | 131 Oobe.showSigninUI(); |
| 134 // Prevent further propagation of click event. Otherwise, the click event | 132 // Prevent further propagation of click event. Otherwise, the click event |
| 135 // handler of document object will set wallpaper to user's wallpaper when | 133 // handler of document object will set wallpaper to user's wallpaper when |
| 136 // there is only one existing user. See http://crbug.com/166477 | 134 // there is only one existing user. See http://crbug.com/166477 |
| 137 e.stopPropagation(); | 135 e.stopPropagation(); |
| 138 }, | 136 }, |
| 139 | 137 |
| 140 handleMoreSettingsClick_: function(e) { | 138 handleMoreSettingsClick_: function(e) { |
| 141 this.isMoreSettingsActive = !this.isMoreSettingsActive; | 139 this.isMoreSettingsActive = !this.isMoreSettingsActive; |
| 142 this.addSupervisedUserMenu.focus(); | 140 this.addSupervisedUserMenu.focus(); |
| 143 e.stopPropagation(); | 141 e.stopPropagation(); |
| 144 }, | 142 }, |
| 145 | 143 |
| 146 handleClick_: function(e) { | 144 handleClick_: function(e) { |
| 147 this.isMoreSettingsActive = false; | 145 this.isMoreSettingsActive = false; |
| 148 }, | 146 }, |
| 149 | 147 |
| 150 handleAddSupervisedUserClick_: function(e) { | |
| 151 chrome.send('showSupervisedUserCreationScreen'); | |
| 152 e.preventDefault(); | |
| 153 }, | |
| 154 | |
| 155 /** | 148 /** |
| 156 * Cancel add user button click handler. | 149 * Cancel add user button click handler. |
| 157 * | 150 * |
| 158 * @private | 151 * @private |
| 159 */ | 152 */ |
| 160 handleCancelAddUserClick_: function(e) { | 153 handleCancelAddUserClick_: function(e) { |
| 161 // Let screen handle cancel itself if that is capable of doing so. | 154 // Let screen handle cancel itself if that is capable of doing so. |
| 162 if (Oobe.getInstance().currentScreen && | 155 if (Oobe.getInstance().currentScreen && |
| 163 Oobe.getInstance().currentScreen.cancel) { | 156 Oobe.getInstance().currentScreen.cancel) { |
| 164 Oobe.getInstance().currentScreen.cancel(); | 157 Oobe.getInstance().currentScreen.cancel(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 * Cancel user adding button handler. | 197 * Cancel user adding button handler. |
| 205 * | 198 * |
| 206 * @private | 199 * @private |
| 207 */ | 200 */ |
| 208 handleCancelMultipleSignInClick_: function(e) { | 201 handleCancelMultipleSignInClick_: function(e) { |
| 209 chrome.send('cancelUserAdding'); | 202 chrome.send('cancelUserAdding'); |
| 210 e.stopPropagation(); | 203 e.stopPropagation(); |
| 211 }, | 204 }, |
| 212 | 205 |
| 213 /** | 206 /** |
| 207 * Add supervised user button handler. |
| 208 * |
| 209 * @private |
| 210 */ |
| 211 handleAddSupervisedUserClick_: function(e) { |
| 212 chrome.send('showSupervisedUserCreationScreen'); |
| 213 e.preventDefault(); |
| 214 }, |
| 215 |
| 216 /** |
| 217 * Add supervised user key handler, ESC closes menu. |
| 218 * |
| 219 * @private |
| 220 */ |
| 221 handleAddSupervisedUserKeyDown_: function(e) { |
| 222 if (e.key == 'Escape' && this.isMoreSettingsActive) { |
| 223 this.isMoreSettingsActive = false; |
| 224 $('more-settings-button').focus(); |
| 225 } |
| 226 }, |
| 227 |
| 228 /** |
| 214 * If true then "Browse as Guest" button is shown. | 229 * If true then "Browse as Guest" button is shown. |
| 215 * | 230 * |
| 216 * @type {boolean} | 231 * @type {boolean} |
| 217 */ | 232 */ |
| 218 set showGuestButton(value) { | 233 set showGuestButton(value) { |
| 219 this.showGuest_ = value; | 234 this.showGuest_ = value; |
| 220 this.updateUI_(); | 235 this.updateUI_(); |
| 221 }, | 236 }, |
| 222 | 237 |
| 223 set showCreateSupervisedButton(value) { | 238 set showCreateSupervisedButton(value) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 * Convenience wrapper of animateIn. | 409 * Convenience wrapper of animateIn. |
| 395 */ | 410 */ |
| 396 HeaderBar.animateIn = function(fast, callback) { | 411 HeaderBar.animateIn = function(fast, callback) { |
| 397 $('login-header-bar').animateIn(fast, callback); | 412 $('login-header-bar').animateIn(fast, callback); |
| 398 }; | 413 }; |
| 399 | 414 |
| 400 return { | 415 return { |
| 401 HeaderBar: HeaderBar | 416 HeaderBar: HeaderBar |
| 402 }; | 417 }; |
| 403 }); | 418 }); |
| OLD | NEW |