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 /** |
11 * Creates a header bar element. | 11 * Creates a header bar element. |
12 * | 12 * |
13 * @constructor | 13 * @constructor |
14 * @extends {HTMLDivElement} | 14 * @extends {HTMLDivElement} |
15 */ | 15 */ |
16 var HeaderBar = cr.ui.define('div'); | 16 var HeaderBar = cr.ui.define('div'); |
17 | 17 |
18 HeaderBar.prototype = { | 18 HeaderBar.prototype = { |
19 __proto__: HTMLDivElement.prototype, | 19 __proto__: HTMLDivElement.prototype, |
20 | 20 |
21 // Whether guest button should be shown when header bar is in normal mode. | 21 // Whether guest button should be shown when header bar is in normal mode. |
22 showGuest_: false, | 22 showGuest_: false, |
23 | 23 |
24 // Whether the reboot button should be shown the when header bar is in | |
25 // normal mode. | |
26 showReboot_: false, | |
27 | |
28 // Whether the shutdown button should be shown when the header bar is in | |
29 // normal mode. | |
30 showShutdown_: true, | |
31 | |
24 // Current UI state of the sign-in screen. | 32 // Current UI state of the sign-in screen. |
25 signinUIState_: SIGNIN_UI_STATE.HIDDEN, | 33 signinUIState_: SIGNIN_UI_STATE.HIDDEN, |
26 | 34 |
27 // Whether to show kiosk apps menu. | 35 // Whether to show kiosk apps menu. |
28 hasApps_: false, | 36 hasApps_: false, |
29 | 37 |
30 /** @override */ | 38 /** @override */ |
31 decorate: function() { | 39 decorate: function() { |
32 $('shutdown-header-bar-item').addEventListener('click', | 40 $('shutdown-header-bar-item').addEventListener('click', |
33 this.handleShutdownClick_); | 41 this.handleShutdownClick_); |
34 $('shutdown-button').addEventListener('click', | 42 $('shutdown-button').addEventListener('click', |
35 this.handleShutdownClick_); | 43 this.handleShutdownClick_); |
44 $('restart-header-bar-item').addEventListener('click', | |
45 this.handleRestartClick_); | |
46 $('restart-button').addEventListener('click', | |
47 this.handleRestartClick_); | |
36 $('add-user-button').addEventListener('click', | 48 $('add-user-button').addEventListener('click', |
37 this.handleAddUserClick_); | 49 this.handleAddUserClick_); |
38 $('cancel-add-user-button').addEventListener('click', | 50 $('cancel-add-user-button').addEventListener('click', |
39 this.handleCancelAddUserClick_); | 51 this.handleCancelAddUserClick_); |
40 $('guest-user-header-bar-item').addEventListener('click', | 52 $('guest-user-header-bar-item').addEventListener('click', |
41 this.handleGuestClick_); | 53 this.handleGuestClick_); |
42 $('guest-user-button').addEventListener('click', | 54 $('guest-user-button').addEventListener('click', |
43 this.handleGuestClick_); | 55 this.handleGuestClick_); |
44 $('sign-out-user-button').addEventListener('click', | 56 $('sign-out-user-button').addEventListener('click', |
45 this.handleSignoutClick_); | 57 this.handleSignoutClick_); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 * Shutdown button click handler. | 152 * Shutdown button click handler. |
141 * | 153 * |
142 * @private | 154 * @private |
143 */ | 155 */ |
144 handleShutdownClick_: function(e) { | 156 handleShutdownClick_: function(e) { |
145 chrome.send('shutdownSystem'); | 157 chrome.send('shutdownSystem'); |
146 e.stopPropagation(); | 158 e.stopPropagation(); |
147 }, | 159 }, |
148 | 160 |
149 /** | 161 /** |
162 * Restart button click handler. | |
163 * | |
164 * @private | |
165 */ | |
166 handleRestartClick_: function(e) { | |
167 chrome.send('restartSystem'); | |
stevenjb
2014/12/17 19:09:02
I think that this should also just call 'shutdownO
| |
168 e.stopPropagation(); | |
169 }, | |
170 | |
171 /** | |
150 * Cancel user adding button handler. | 172 * Cancel user adding button handler. |
151 * | 173 * |
152 * @private | 174 * @private |
153 */ | 175 */ |
154 handleCancelMultipleSignInClick_: function(e) { | 176 handleCancelMultipleSignInClick_: function(e) { |
155 chrome.send('cancelUserAdding'); | 177 chrome.send('cancelUserAdding'); |
156 e.stopPropagation(); | 178 e.stopPropagation(); |
157 }, | 179 }, |
158 | 180 |
159 /** | 181 /** |
(...skipping 10 matching lines...) Expand all Loading... | |
170 * If true then "Browse as Guest" button is shown. | 192 * If true then "Browse as Guest" button is shown. |
171 * | 193 * |
172 * @type {boolean} | 194 * @type {boolean} |
173 */ | 195 */ |
174 set showGuestButton(value) { | 196 set showGuestButton(value) { |
175 this.showGuest_ = value; | 197 this.showGuest_ = value; |
176 this.updateUI_(); | 198 this.updateUI_(); |
177 }, | 199 }, |
178 | 200 |
179 /** | 201 /** |
202 * If true the "Restart" button is shown. | |
203 * | |
204 * @type {boolean} | |
205 */ | |
206 set showRebootButton(value) { | |
207 this.showReboot_ = value; | |
208 this.updateUI_(); | |
209 }, | |
210 | |
211 /** | |
212 * If true the "Shutdown" button is shown. | |
213 * | |
214 * @type {boolean} | |
215 */ | |
216 set showShutdownButton(value) { | |
217 this.showShutdown_ = value; | |
218 this.updateUI_(); | |
219 }, | |
220 | |
221 /** | |
180 * Current header bar UI / sign in state. | 222 * Current header bar UI / sign in state. |
181 * | 223 * |
182 * @type {number} state Current state of the sign-in screen (see | 224 * @type {number} state Current state of the sign-in screen (see |
183 * SIGNIN_UI_STATE). | 225 * SIGNIN_UI_STATE). |
184 */ | 226 */ |
185 get signinUIState() { | 227 get signinUIState() { |
186 return this.signinUIState_; | 228 return this.signinUIState_; |
187 }, | 229 }, |
188 set signinUIState(state) { | 230 set signinUIState(state) { |
189 this.signinUIState_ = state; | 231 this.signinUIState_ = state; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 $('cancel-add-user-button').hidden = accountPickerIsActive || | 280 $('cancel-add-user-button').hidden = accountPickerIsActive || |
239 !this.allowCancel_ || | 281 !this.allowCancel_ || |
240 wrongHWIDWarningIsActive || | 282 wrongHWIDWarningIsActive || |
241 isMultiProfilesUI; | 283 isMultiProfilesUI; |
242 $('guest-user-header-bar-item').hidden = gaiaIsActive || | 284 $('guest-user-header-bar-item').hidden = gaiaIsActive || |
243 supervisedUserCreationDialogIsActive || | 285 supervisedUserCreationDialogIsActive || |
244 !this.showGuest_ || | 286 !this.showGuest_ || |
245 wrongHWIDWarningIsActive || | 287 wrongHWIDWarningIsActive || |
246 isSamlPasswordConfirm || | 288 isSamlPasswordConfirm || |
247 isMultiProfilesUI; | 289 isMultiProfilesUI; |
290 $('restart-header-bar-item').hidden = !this.showReboot_; | |
291 $('shutdown-header-bar-item').hidden = !this.showShutdown_; | |
248 $('sign-out-user-item').hidden = !isLockScreen; | 292 $('sign-out-user-item').hidden = !isLockScreen; |
249 | 293 |
250 $('add-user-header-bar-item').hidden = | 294 $('add-user-header-bar-item').hidden = |
251 $('add-user-button').hidden && $('cancel-add-user-button').hidden; | 295 $('add-user-button').hidden && $('cancel-add-user-button').hidden; |
252 $('apps-header-bar-item').hidden = !this.hasApps_ || | 296 $('apps-header-bar-item').hidden = !this.hasApps_ || |
253 (!gaiaIsActive && !accountPickerIsActive); | 297 (!gaiaIsActive && !accountPickerIsActive); |
254 $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI; | 298 $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI; |
255 $('cancel-consumer-management-enrollment').hidden = | 299 $('cancel-consumer-management-enrollment').hidden = |
256 !isEnrollingConsumerManagement; | 300 !isEnrollingConsumerManagement; |
257 | 301 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 * Convenience wrapper of animateIn. | 365 * Convenience wrapper of animateIn. |
322 */ | 366 */ |
323 HeaderBar.animateIn = function(callback) { | 367 HeaderBar.animateIn = function(callback) { |
324 $('login-header-bar').animateIn(callback); | 368 $('login-header-bar').animateIn(callback); |
325 }; | 369 }; |
326 | 370 |
327 return { | 371 return { |
328 HeaderBar: HeaderBar | 372 HeaderBar: HeaderBar |
329 }; | 373 }; |
330 }); | 374 }); |
OLD | NEW |