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

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

Issue 11308081: cros: Account picker UI for public account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased on top of 11419184 Created 8 years 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 | Annotate | Revision Log
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 User pod row implementation. 6 * @fileoverview User pod row implementation.
7 */ 7 */
8 8
9 cr.define('login', function() { 9 cr.define('login', function() {
10 /** 10 /**
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 /** 190 /**
191 * Gets password field. 191 * Gets password field.
192 * @type {!HTMLInputElement} 192 * @type {!HTMLInputElement}
193 */ 193 */
194 get passwordElement() { 194 get passwordElement() {
195 return this.nameElement.nextElementSibling; 195 return this.nameElement.nextElementSibling;
196 }, 196 },
197 197
198 /** 198 /**
199 * Gets managed badge image.
200 * @type {!HTMLImageElement}
201 */
202 get managedBadgeElement() {
203 return this.capslockHintElement.previousElementSibling;
204 },
205
206 /**
199 * Gets Caps Lock hint image. 207 * Gets Caps Lock hint image.
200 * @type {!HTMLImageElement} 208 * @type {!HTMLImageElement}
201 */ 209 */
202 get capslockHintElement() { 210 get capslockHintElement() {
203 return this.signinButtonElement.previousElementSibling; 211 return this.signinButtonElement.previousElementSibling;
204 }, 212 },
205 213
206 /** 214 /**
207 * Gets user signin button. 215 * Gets user signin button.
208 * @type {!HTMLInputElement} 216 * @type {!HTMLInputElement}
(...skipping 23 matching lines...) Expand all
232 var needSignin = this.needGaiaSignin; 240 var needSignin = this.needGaiaSignin;
233 this.passwordElement.hidden = needSignin; 241 this.passwordElement.hidden = needSignin;
234 this.removeUserButtonElement.setAttribute( 242 this.removeUserButtonElement.setAttribute(
235 'aria-label', localStrings.getStringF('removeButtonAccessibleName', 243 'aria-label', localStrings.getStringF('removeButtonAccessibleName',
236 this.user_.emailAddress)); 244 this.user_.emailAddress));
237 this.passwordElement.setAttribute('aria-label', 245 this.passwordElement.setAttribute('aria-label',
238 localStrings.getStringF( 246 localStrings.getStringF(
239 'passwordFieldAccessibleName', 247 'passwordFieldAccessibleName',
240 this.user_.emailAddress)); 248 this.user_.emailAddress));
241 this.signinButtonElement.hidden = !needSignin; 249 this.signinButtonElement.hidden = !needSignin;
250
251 if (this.user.publicAccount) {
bartfab (slow) 2012/11/28 15:11:38 As described below, I think a separate |this.user.
xiyuan 2012/12/01 00:24:19 Created a new PublicAccountUserPod that derives fr
252 this.classList.remove('need-password');
253 this.managedBadgeElement.hidden = false;
254 } else {
255 this.classList.add('need-password');
256 this.managedBadgeElement.hidden = true;
257 }
242 }, 258 },
243 259
244 /** 260 /**
245 * The user that this pod represents. 261 * The user that this pod represents.
246 * @type {!Object} 262 * @type {!Object}
247 */ 263 */
248 user_: undefined, 264 user_: undefined,
249 get user() { 265 get user() {
250 return this.user_; 266 return this.user_;
251 }, 267 },
252 set user(userDict) { 268 set user(userDict) {
253 this.user_ = userDict; 269 this.user_ = userDict;
254 this.update(); 270 this.update();
255 }, 271 },
256 272
257 /** 273 /**
258 * Whether Gaia signin is required for this user. 274 * Whether Gaia signin is required for this user.
259 */ 275 */
260 get needGaiaSignin() { 276 get needGaiaSignin() {
261 // Gaia signin is performed if the user has an invalid oauth token and is 277 // Gaia signin is performed if the user has an invalid oauth token and is
262 // not currently signed in (i.e. not the lock screen). 278 // not currently signed in (i.e. not the lock screen) and is not a public
bartfab (slow) 2012/11/28 15:11:38 Nit: "public account user" (for consistency throug
xiyuan 2012/12/01 00:24:19 This change is reverted in new patch.
279 // user.
263 return this.user.oauthTokenStatus != OAuthTokenStatus.VALID && 280 return this.user.oauthTokenStatus != OAuthTokenStatus.VALID &&
264 !this.user.signedIn; 281 !this.user.signedIn &&
282 !this.user.publicAccount;
bartfab (slow) 2012/11/28 15:11:38 This is a bit akin to user agent sniffing: What yo
xiyuan 2012/12/01 00:24:19 Reverted the change here. In new PublicAccountUser
265 }, 283 },
266 284
267 /** 285 /**
268 * Gets main input element. 286 * Gets main input element.
269 * @type {(HTMLButtonElement|HTMLInputElement)} 287 * @type {(HTMLButtonElement|HTMLInputElement)}
270 */ 288 */
271 get mainInput() { 289 get mainInput() {
272 if (!this.signinButtonElement.hidden) 290 if (!this.signinButtonElement.hidden)
273 return this.signinButtonElement; 291 return this.signinButtonElement;
274 else 292 else
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 this.tabIndex = -1; 337 this.tabIndex = -1;
320 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; 338 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT;
321 this.mainInput.focus(); 339 this.mainInput.focus();
322 }, 340 },
323 341
324 /** 342 /**
325 * Activates the pod. 343 * Activates the pod.
326 * @return {boolean} True if activated successfully. 344 * @return {boolean} True if activated successfully.
327 */ 345 */
328 activate: function() { 346 activate: function() {
329 if (!this.signinButtonElement.hidden) { 347 if (this.user.publicAccount) {
348 Oobe.showScreen({
bartfab (slow) 2012/11/28 15:11:38 I have not run the code but I would imagine that t
Nikita (slow) 2012/11/28 18:57:34 Yes, that would be the right thing to do but that
xiyuan 2012/12/01 00:24:19 Refactored the CL to expand user pod instead of us
349 id: SCREEN_PUBLIC_ACCOUNT_SIGNIN,
350 data: {
351 name: this.user_.displayName,
352 email: this.user_.username,
353 imageUrl: this.imageElement.src
bartfab (slow) 2012/11/28 15:11:38 The avatar is loaded asynchronously. It may happen
Ivan Korotkov 2012/11/28 21:50:39 'src' should still be accessible while it loads, r
bartfab (slow) 2012/11/29 14:32:28 Sure, the |src| is accessible - but what does it p
Ivan Korotkov 2012/11/29 17:23:20 Right, I missed that.
xiyuan 2012/12/01 00:24:19 New patch expand user pod in-place and will no lon
354 }
355 });
356 } else if (!this.signinButtonElement.hidden) {
330 // Switch to Gaia signin. 357 // Switch to Gaia signin.
331 this.showSigninUI(); 358 this.showSigninUI();
332 } else if (!this.passwordElement.value) { 359 } else if (!this.passwordElement.value) {
333 return false; 360 return false;
334 } else { 361 } else {
335 Oobe.disableSigninUI(); 362 Oobe.disableSigninUI();
336 chrome.send('authenticateUser', 363 chrome.send('authenticateUser',
337 [this.user.username, this.passwordElement.value]); 364 [this.user.username, this.passwordElement.value]);
338 } 365 }
339 366
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 this.activeRemoveButton = true; 407 this.activeRemoveButton = true;
381 }, 408 },
382 409
383 /** 410 /**
384 * Handles mousedown event on a user pod. 411 * Handles mousedown event on a user pod.
385 * @param {Event} e Mouseout event. 412 * @param {Event} e Mouseout event.
386 */ 413 */
387 handleMouseDown_: function(e) { 414 handleMouseDown_: function(e) {
388 if (this.parentNode.disabled) 415 if (this.parentNode.disabled)
389 return; 416 return;
390 if (!this.signinButtonElement.hidden) { 417 if (this.user.publicAccount) {
418 this.parentNode.activatedPod = this;
419 // Prevent default so that we don't trigger 'focus' event.
420 e.preventDefault();
421 } else if (!this.signinButtonElement.hidden) {
391 this.showSigninUI(); 422 this.showSigninUI();
bartfab (slow) 2012/11/28 15:11:38 Any idea why this line uses |this.showSigninUI()|
Ivan Korotkov 2012/11/28 21:50:39 Because if signingButton.hidden == false, that mea
bartfab (slow) 2012/11/29 14:32:28 Thanks for clarifying.
392 // Prevent default so that we don't trigger 'focus' event. 423 // Prevent default so that we don't trigger 'focus' event.
393 e.preventDefault(); 424 e.preventDefault();
394 } 425 }
395 } 426 }
396 }; 427 };
397 428
398 429
399 /** 430 /**
400 * Creates a new pod row element. 431 * Creates a new pod row element.
401 * @constructor 432 * @constructor
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 this.classList.remove('images-loading'); 980 this.classList.remove('images-loading');
950 chrome.send('userImagesLoaded'); 981 chrome.send('userImagesLoaded');
951 } 982 }
952 } 983 }
953 }; 984 };
954 985
955 return { 986 return {
956 PodRow: PodRow 987 PodRow: PodRow
957 }; 988 };
958 }); 989 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698