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

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

Issue 2609393003: ESC button closes Add Supervised User menu (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (active) {
120 this.getMoreSettingsMenu.classList.add('active'); 122 this.getMoreSettingsMenu.classList.add('active');
xiyuan 2017/01/09 21:55:43 nit: maybe change this and line 125 to this.get
Greg Levin 2017/01/09 22:34:40 Done.
123 $('more-settings-button').tabIndex = -1;
xiyuan 2017/01/09 21:55:43 Is changing tabIndex necessary? If the intention
Greg Levin 2017/01/09 22:34:40 The intent is only to remove the [...] button from
xiyuan 2017/01/09 23:17:43 I understand what we are trying to do and agree th
121 } else { 124 } else {
122 this.getMoreSettingsMenu.classList.remove('active'); 125 this.getMoreSettingsMenu.classList.remove('active');
126 $('more-settings-button').tabIndex = 0;
123 } 127 }
124 }, 128 },
125 129
126 130
127 /** 131 /**
128 * Add user button click handler. 132 * Add user button click handler.
129 * 133 *
130 * @private 134 * @private
131 */ 135 */
132 handleAddUserClick_: function(e) { 136 handleAddUserClick_: function(e) {
133 Oobe.showSigninUI(); 137 Oobe.showSigninUI();
134 // Prevent further propagation of click event. Otherwise, the click event 138 // Prevent further propagation of click event. Otherwise, the click event
135 // handler of document object will set wallpaper to user's wallpaper when 139 // handler of document object will set wallpaper to user's wallpaper when
136 // there is only one existing user. See http://crbug.com/166477 140 // there is only one existing user. See http://crbug.com/166477
137 e.stopPropagation(); 141 e.stopPropagation();
138 }, 142 },
139 143
140 handleMoreSettingsClick_: function(e) { 144 handleMoreSettingsClick_: function(e) {
141 this.isMoreSettingsActive = !this.isMoreSettingsActive; 145 this.isMoreSettingsActive = !this.isMoreSettingsActive;
142 this.addSupervisedUserMenu.focus(); 146 this.addSupervisedUserMenu.focus();
143 e.stopPropagation(); 147 e.stopPropagation();
144 }, 148 },
145 149
146 handleClick_: function(e) { 150 handleClick_: function(e) {
147 this.isMoreSettingsActive = false; 151 this.isMoreSettingsActive = false;
148 }, 152 },
149 153
150 handleAddSupervisedUserClick_: function(e) {
151 chrome.send('showSupervisedUserCreationScreen');
152 e.preventDefault();
153 },
154
155 /** 154 /**
156 * Cancel add user button click handler. 155 * Cancel add user button click handler.
157 * 156 *
158 * @private 157 * @private
159 */ 158 */
160 handleCancelAddUserClick_: function(e) { 159 handleCancelAddUserClick_: function(e) {
161 // Let screen handle cancel itself if that is capable of doing so. 160 // Let screen handle cancel itself if that is capable of doing so.
162 if (Oobe.getInstance().currentScreen && 161 if (Oobe.getInstance().currentScreen &&
163 Oobe.getInstance().currentScreen.cancel) { 162 Oobe.getInstance().currentScreen.cancel) {
164 Oobe.getInstance().currentScreen.cancel(); 163 Oobe.getInstance().currentScreen.cancel();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 * Cancel user adding button handler. 203 * Cancel user adding button handler.
205 * 204 *
206 * @private 205 * @private
207 */ 206 */
208 handleCancelMultipleSignInClick_: function(e) { 207 handleCancelMultipleSignInClick_: function(e) {
209 chrome.send('cancelUserAdding'); 208 chrome.send('cancelUserAdding');
210 e.stopPropagation(); 209 e.stopPropagation();
211 }, 210 },
212 211
213 /** 212 /**
213 * Add supervised user button handler.
214 *
215 * @private
216 */
217 handleAddSupervisedUserClick_: function(e) {
218 chrome.send('showSupervisedUserCreationScreen');
219 e.preventDefault();
220 },
221
222 /**
223 * Add supervised user key handler, ESC closes menu.
224 *
225 * @private
226 */
227 handleAddSupervisedUserKeyDown_: function(e) {
228 if (e.key == 'Escape' && this.isMoreSettingsActive) {
229 this.isMoreSettingsActive = false;
230 $('more-settings-button').focus();
231 }
232 },
233
234 /**
214 * If true then "Browse as Guest" button is shown. 235 * If true then "Browse as Guest" button is shown.
215 * 236 *
216 * @type {boolean} 237 * @type {boolean}
217 */ 238 */
218 set showGuestButton(value) { 239 set showGuestButton(value) {
219 this.showGuest_ = value; 240 this.showGuest_ = value;
220 this.updateUI_(); 241 this.updateUI_();
221 }, 242 },
222 243
223 set showCreateSupervisedButton(value) { 244 set showCreateSupervisedButton(value) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 * Convenience wrapper of animateIn. 415 * Convenience wrapper of animateIn.
395 */ 416 */
396 HeaderBar.animateIn = function(fast, callback) { 417 HeaderBar.animateIn = function(fast, callback) {
397 $('login-header-bar').animateIn(fast, callback); 418 $('login-header-bar').animateIn(fast, callback);
398 }; 419 };
399 420
400 return { 421 return {
401 HeaderBar: HeaderBar 422 HeaderBar: HeaderBar
402 }; 423 };
403 }); 424 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698