Chromium Code Reviews| 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 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 * @type {!HTMLInputElement} | 292 * @type {!HTMLInputElement} |
| 293 */ | 293 */ |
| 294 get actionBoxMenuRemoveElement() { | 294 get actionBoxMenuRemoveElement() { |
| 295 return this.querySelector('.action-box-menu-remove'); | 295 return this.querySelector('.action-box-menu-remove'); |
| 296 }, | 296 }, |
| 297 | 297 |
| 298 /** | 298 /** |
| 299 * Updates the user pod element. | 299 * Updates the user pod element. |
| 300 */ | 300 */ |
| 301 update: function() { | 301 update: function() { |
| 302 this.imageElement.src = 'chrome://userimage/' + this.user.username + | 302 if (this.user.isDesktopScreen) { |
| 303 '?id=' + UserPod.userImageSalt_[this.user.username]; | 303 this.imageElement.src = this.user.userImage; |
| 304 } else { | |
| 305 this.imageElement.src = 'chrome://userimage/' + this.user.username + | |
| 306 '?id=' + UserPod.userImageSalt_[this.user.username]; | |
| 307 } | |
|
Roger Tawa OOO till Jul 10th
2013/06/05 18:53:56
Would it be possible to derive something like Desk
noms
2013/06/06 19:01:36
Done.
| |
| 304 | 308 |
| 305 this.nameElement.textContent = this.user_.displayName; | 309 this.nameElement.textContent = this.user_.displayName; |
| 306 this.actionBoxAreaElement.hidden = this.user_.publicAccount; | 310 this.actionBoxAreaElement.hidden = this.user_.publicAccount; |
| 307 this.actionBoxMenuRemoveElement.hidden = !this.user_.canRemove; | 311 this.actionBoxMenuRemoveElement.hidden = !this.user_.canRemove; |
| 308 this.signedInIndicatorElement.hidden = !this.user_.signedIn; | 312 this.signedInIndicatorElement.hidden = !this.user_.signedIn; |
| 309 | 313 |
| 310 var needSignin = this.needGaiaSignin; | 314 var needSignin = this.needGaiaSignin; |
| 311 this.passwordElement.hidden = needSignin; | 315 this.passwordElement.hidden = needSignin; |
| 312 this.actionBoxAreaElement.setAttribute( | 316 this.actionBoxAreaElement.setAttribute( |
| 313 'aria-label', loadTimeData.getStringF( | 317 'aria-label', loadTimeData.getStringF( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 this.tabIndex = -1; | 431 this.tabIndex = -1; |
| 428 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; | 432 this.mainInput.tabIndex = UserPodTabOrder.POD_INPUT; |
| 429 this.mainInput.focus(); | 433 this.mainInput.focus(); |
| 430 }, | 434 }, |
| 431 | 435 |
| 432 /** | 436 /** |
| 433 * Activates the pod. | 437 * Activates the pod. |
| 434 * @return {boolean} True if activated successfully. | 438 * @return {boolean} True if activated successfully. |
| 435 */ | 439 */ |
| 436 activate: function() { | 440 activate: function() { |
| 441 if (this.user.isDesktopScreen) { | |
| 442 Oobe.launchUser(this.user.emailAddress, | |
| 443 this.user.displayName); | |
| 444 return; | |
| 445 } | |
| 446 | |
| 437 if (!this.signinButtonElement.hidden) { | 447 if (!this.signinButtonElement.hidden) { |
| 438 // Switch to Gaia signin. | 448 // Switch to Gaia signin. |
| 439 this.showSigninUI(); | 449 this.showSigninUI(); |
| 440 } else if (!this.passwordElement.value) { | 450 } else if (!this.passwordElement.value) { |
| 441 return false; | 451 return false; |
| 442 } else { | 452 } else { |
| 443 Oobe.disableSigninUI(); | 453 Oobe.disableSigninUI(); |
| 444 chrome.send('authenticateUser', | 454 chrome.send('authenticateUser', |
| 445 [this.user.username, this.passwordElement.value]); | 455 [this.user.username, this.passwordElement.value]); |
| 446 } | 456 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 this.actionBoxMenuRemoveElement.tabIndex = -1; | 569 this.actionBoxMenuRemoveElement.tabIndex = -1; |
| 560 }, | 570 }, |
| 561 | 571 |
| 562 /** | 572 /** |
| 563 * Handles mousedown event on a user pod. | 573 * Handles mousedown event on a user pod. |
| 564 * @param {Event} e Mousedown event. | 574 * @param {Event} e Mousedown event. |
| 565 */ | 575 */ |
| 566 handleMouseDown_: function(e) { | 576 handleMouseDown_: function(e) { |
| 567 if (this.parentNode.disabled) | 577 if (this.parentNode.disabled) |
| 568 return; | 578 return; |
| 579 | |
| 580 // We don't want to sign in until the user presses | |
| 581 // the button. Just activate the pod. | |
| 582 if (this.user.isDesktopScreen) { | |
| 583 Oobe.clearErrors(); | |
| 584 this.disabled = true; | |
| 585 this.parentNode.lastFocusedPod_ = | |
| 586 this.parentNode.getPodWithUsername_(this.user.emailAddress); | |
| 587 return; | |
| 588 } | |
| 589 | |
|
Roger Tawa OOO till Jul 10th
2013/06/05 18:53:56
Should probably move this file to a directory that
noms
2013/06/06 19:01:36
This file is actually part of pretty large codebas
| |
| 569 if (!this.signinButtonElement.hidden && !this.isActionBoxMenuActive) { | 590 if (!this.signinButtonElement.hidden && !this.isActionBoxMenuActive) { |
| 570 this.showSigninUI(); | 591 this.showSigninUI(); |
| 571 // Prevent default so that we don't trigger 'focus' event. | 592 // Prevent default so that we don't trigger 'focus' event. |
| 572 e.preventDefault(); | 593 e.preventDefault(); |
| 573 } | 594 } |
| 574 } | 595 } |
| 575 }; | 596 }; |
| 576 | 597 |
| 577 /** | 598 /** |
| 578 * Creates a public account user pod. | 599 * Creates a public account user pod. |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1403 this.classList.remove('images-loading'); | 1424 this.classList.remove('images-loading'); |
| 1404 chrome.send('userImagesLoaded'); | 1425 chrome.send('userImagesLoaded'); |
| 1405 } | 1426 } |
| 1406 } | 1427 } |
| 1407 }; | 1428 }; |
| 1408 | 1429 |
| 1409 return { | 1430 return { |
| 1410 PodRow: PodRow | 1431 PodRow: PodRow |
| 1411 }; | 1432 }; |
| 1412 }); | 1433 }); |
| OLD | NEW |