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

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

Issue 1411423006: Simplifed logic of showing/hiding cancel buttons on login screens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix. Created 5 years, 2 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 /**
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 $('shutdown-button').addEventListener('click', 47 $('shutdown-button').addEventListener('click',
48 this.handleShutdownClick_); 48 this.handleShutdownClick_);
49 $('restart-header-bar-item').addEventListener('click', 49 $('restart-header-bar-item').addEventListener('click',
50 this.handleShutdownClick_); 50 this.handleShutdownClick_);
51 $('restart-button').addEventListener('click', 51 $('restart-button').addEventListener('click',
52 this.handleShutdownClick_); 52 this.handleShutdownClick_);
53 $('add-user-button').addEventListener('click', 53 $('add-user-button').addEventListener('click',
54 this.handleAddUserClick_); 54 this.handleAddUserClick_);
55 $('more-settings-button').addEventListener('click', 55 $('more-settings-button').addEventListener('click',
56 this.handleMoreSettingsClick_.bind(this)); 56 this.handleMoreSettingsClick_.bind(this));
57 $('cancel-add-user-button').addEventListener('click',
58 this.handleCancelAddUserClick_);
59 $('guest-user-header-bar-item').addEventListener('click', 57 $('guest-user-header-bar-item').addEventListener('click',
60 this.handleGuestClick_); 58 this.handleGuestClick_);
61 $('guest-user-button').addEventListener('click', 59 $('guest-user-button').addEventListener('click',
62 this.handleGuestClick_); 60 this.handleGuestClick_);
63 $('sign-out-user-button').addEventListener('click', 61 $('sign-out-user-button').addEventListener('click',
64 this.handleSignoutClick_); 62 this.handleSignoutClick_);
65 $('cancel-multiple-sign-in-button').addEventListener('click', 63 $('cancel-multiple-sign-in-button').addEventListener('click',
66 this.handleCancelMultipleSignInClick_); 64 this.handleCancelMultipleSignInClick_);
67 $('cancel-consumer-management-enrollment-button').addEventListener( 65 $('cancel-consumer-management-enrollment-button').addEventListener(
68 'click', 66 'click',
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 */ 266 */
269 get signinUIState() { 267 get signinUIState() {
270 return this.signinUIState_; 268 return this.signinUIState_;
271 }, 269 },
272 set signinUIState(state) { 270 set signinUIState(state) {
273 this.signinUIState_ = state; 271 this.signinUIState_ = state;
274 this.updateUI_(); 272 this.updateUI_();
275 }, 273 },
276 274
277 /** 275 /**
278 * Whether the Cancel button is enabled during Gaia sign-in.
279 *
280 * @type {boolean}
281 */
282 set allowCancel(value) {
283 this.allowCancel_ = value;
284 this.updateUI_();
285 },
286
287 get allowCancel() {
288 return !!this.allowCancel_;
289 },
290
291 /**
292 * Update whether there are kiosk apps. 276 * Update whether there are kiosk apps.
293 * 277 *
294 * @type {boolean} 278 * @type {boolean}
295 */ 279 */
296 set hasApps(value) { 280 set hasApps(value) {
297 this.hasApps_ = value; 281 this.hasApps_ = value;
298 this.updateUI_(); 282 this.updateUI_();
299 }, 283 },
300 284
301 /** 285 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 !accountPickerIsActive || 319 !accountPickerIsActive ||
336 isMultiProfilesUI || 320 isMultiProfilesUI ||
337 isLockScreen || 321 isLockScreen ||
338 errorScreenIsActive; 322 errorScreenIsActive;
339 $('more-settings-header-bar-item').hidden = 323 $('more-settings-header-bar-item').hidden =
340 !this.showCreateSupervised_ || 324 !this.showCreateSupervised_ ||
341 gaiaIsActive || 325 gaiaIsActive ||
342 isLockScreen || 326 isLockScreen ||
343 errorScreenIsActive || 327 errorScreenIsActive ||
344 supervisedUserCreationDialogIsActive; 328 supervisedUserCreationDialogIsActive;
345 $('cancel-add-user-button').hidden =
346 !this.allowCancel_ ||
347 gaiaIsActive ||
348 isPasswordChangedUI ||
349 isSamlPasswordConfirm ||
350 errorScreenIsActive ||
351 accountPickerIsActive ||
352 wrongHWIDWarningIsActive ||
353 isMultiProfilesUI ||
354 supervisedUserCreationDialogIsActive;
355 $('guest-user-header-bar-item').hidden = 329 $('guest-user-header-bar-item').hidden =
356 !this.showGuest_ || 330 !this.showGuest_ ||
357 isLockScreen || 331 isLockScreen ||
358 supervisedUserCreationDialogIsActive || 332 supervisedUserCreationDialogIsActive ||
359 wrongHWIDWarningIsActive || 333 wrongHWIDWarningIsActive ||
360 isSamlPasswordConfirm || 334 isSamlPasswordConfirm ||
361 isMultiProfilesUI || 335 isMultiProfilesUI ||
362 (this.allowCancel_ && gaiaIsActive) || 336 (gaiaIsActive && $('gaia-signin').cancelable) ||
363 enrollmentIsActiveWithBackButton || 337 enrollmentIsActiveWithBackButton ||
364 gaiaIsActiveWithBackButton; 338 gaiaIsActiveWithBackButton;
365 $('restart-header-bar-item').hidden = !this.showReboot_; 339 $('restart-header-bar-item').hidden = !this.showReboot_;
366 $('shutdown-header-bar-item').hidden = !this.showShutdown_; 340 $('shutdown-header-bar-item').hidden = !this.showShutdown_;
367 $('sign-out-user-item').hidden = !isLockScreen; 341 $('sign-out-user-item').hidden = !isLockScreen;
368 342
369 $('add-user-header-bar-item').hidden = 343 $('add-user-header-bar-item').hidden = $('add-user-button').hidden;
370 $('add-user-button').hidden && $('cancel-add-user-button').hidden;
371 $('apps-header-bar-item').hidden = !this.hasApps_ || 344 $('apps-header-bar-item').hidden = !this.hasApps_ ||
372 (!gaiaIsActive && !accountPickerIsActive); 345 (!gaiaIsActive && !accountPickerIsActive);
373 $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI; 346 $('cancel-multiple-sign-in-item').hidden = !isMultiProfilesUI;
374 $('cancel-consumer-management-enrollment').hidden = 347 $('cancel-consumer-management-enrollment').hidden =
375 !isEnrollingConsumerManagement; 348 !isEnrollingConsumerManagement;
376 349
377 if (!Oobe.getInstance().newKioskUI) { 350 if (!Oobe.getInstance().newKioskUI) {
378 if (!$('apps-header-bar-item').hidden) 351 if (!$('apps-header-bar-item').hidden)
379 $('show-apps-button').didShow(); 352 $('show-apps-button').didShow();
380 } 353 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 * Convenience wrapper of animateIn. 415 * Convenience wrapper of animateIn.
443 */ 416 */
444 HeaderBar.animateIn = function(fast, callback) { 417 HeaderBar.animateIn = function(fast, callback) {
445 $('login-header-bar').animateIn(fast, callback); 418 $('login-header-bar').animateIn(fast, callback);
446 }; 419 };
447 420
448 return { 421 return {
449 HeaderBar: HeaderBar 422 HeaderBar: HeaderBar
450 }; 423 };
451 }); 424 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698