Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Side by Side Diff: chrome/browser/resources/chromeos/login/header_bar.js

Issue 871483003: Add device policy to disallow shutdown - WebUI modifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.handleShutdownClick_);
46 $('restart-button').addEventListener('click',
47 this.handleShutdownClick_);
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 * If true then "Browse as Guest" button is shown. 182 * If true then "Browse as Guest" button is shown.
171 * 183 *
172 * @type {boolean} 184 * @type {boolean}
173 */ 185 */
174 set showGuestButton(value) { 186 set showGuestButton(value) {
175 this.showGuest_ = value; 187 this.showGuest_ = value;
176 this.updateUI_(); 188 this.updateUI_();
177 }, 189 },
178 190
179 /** 191 /**
192 * If true the "Restart" button is shown.
193 *
194 * @type {boolean}
195 */
196 set showRebootButton(value) {
197 this.showReboot_ = value;
198 this.updateUI_();
199 },
200
201 /**
202 * If true the "Shutdown" button is shown.
203 *
204 * @type {boolean}
205 */
206 set showShutdownButton(value) {
207 this.showShutdown_ = value;
208 this.updateUI_();
209 },
210
211 /**
180 * Current header bar UI / sign in state. 212 * Current header bar UI / sign in state.
181 * 213 *
182 * @type {number} state Current state of the sign-in screen (see 214 * @type {number} state Current state of the sign-in screen (see
183 * SIGNIN_UI_STATE). 215 * SIGNIN_UI_STATE).
184 */ 216 */
185 get signinUIState() { 217 get signinUIState() {
186 return this.signinUIState_; 218 return this.signinUIState_;
187 }, 219 },
188 set signinUIState(state) { 220 set signinUIState(state) {
189 this.signinUIState_ = state; 221 this.signinUIState_ = state;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 $('cancel-add-user-button').hidden = accountPickerIsActive || 270 $('cancel-add-user-button').hidden = accountPickerIsActive ||
239 !this.allowCancel_ || 271 !this.allowCancel_ ||
240 wrongHWIDWarningIsActive || 272 wrongHWIDWarningIsActive ||
241 isMultiProfilesUI; 273 isMultiProfilesUI;
242 $('guest-user-header-bar-item').hidden = gaiaIsActive || 274 $('guest-user-header-bar-item').hidden = gaiaIsActive ||
243 supervisedUserCreationDialogIsActive || 275 supervisedUserCreationDialogIsActive ||
244 !this.showGuest_ || 276 !this.showGuest_ ||
245 wrongHWIDWarningIsActive || 277 wrongHWIDWarningIsActive ||
246 isSamlPasswordConfirm || 278 isSamlPasswordConfirm ||
247 isMultiProfilesUI; 279 isMultiProfilesUI;
280 $('restart-header-bar-item').hidden = !this.showReboot_;
281 $('shutdown-header-bar-item').hidden = !this.showShutdown_;
248 $('sign-out-user-item').hidden = !isLockScreen; 282 $('sign-out-user-item').hidden = !isLockScreen;
249 283
250 $('add-user-header-bar-item').hidden = 284 $('add-user-header-bar-item').hidden =
251 $('add-user-button').hidden && $('cancel-add-user-button').hidden; 285 $('add-user-button').hidden && $('cancel-add-user-button').hidden;
252 $('apps-header-bar-item').hidden = !this.hasApps_ || 286 $('apps-header-bar-item').hidden = !this.hasApps_ ||
253 (!gaiaIsActive && !accountPickerIsActive); 287 (!gaiaIsActive && !accountPickerIsActive);
254 $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI; 288 $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI;
255 $('cancel-consumer-management-enrollment').hidden = 289 $('cancel-consumer-management-enrollment').hidden =
256 !isEnrollingConsumerManagement; 290 !isEnrollingConsumerManagement;
257 291
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 * Convenience wrapper of animateIn. 355 * Convenience wrapper of animateIn.
322 */ 356 */
323 HeaderBar.animateIn = function(callback) { 357 HeaderBar.animateIn = function(callback) {
324 $('login-header-bar').animateIn(callback); 358 $('login-header-bar').animateIn(callback);
325 }; 359 };
326 360
327 return { 361 return {
328 HeaderBar: HeaderBar 362 HeaderBar: HeaderBar
329 }; 363 };
330 }); 364 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/header_bar.html ('k') | chrome/browser/resources/chromeos/login/login_common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698