Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/screen_account_picker.js |
| diff --git a/chrome/browser/resources/chromeos/login/screen_account_picker.js b/chrome/browser/resources/chromeos/login/screen_account_picker.js |
| index 9f46c8cca1428dff909edae727506b4546b0945a..1e981e37e7d4c70ad80d76400f006e086fd8bdc4 100644 |
| --- a/chrome/browser/resources/chromeos/login/screen_account_picker.js |
| +++ b/chrome/browser/resources/chromeos/login/screen_account_picker.js |
| @@ -10,7 +10,7 @@ cr.define('login', function() { |
| /** |
| * Maximum number of offline login failures before online login. |
| */ |
| - const MAX_LOGIN_ATTEMPTS_IN_POD = 3; |
| + /** @const */ var MAX_LOGIN_ATTEMPTS_IN_POD = 3; |
| /** |
| * Creates a new account picker screen div. |
| @@ -37,7 +37,7 @@ cr.define('login', function() { |
| }, |
| // Whether this screen is shown for the first time. |
| - firstShown_ : true, |
| + firstShown_: true, |
| /** |
| * When the account picker is being used to lock the screen, pressing the |
| @@ -55,7 +55,7 @@ cr.define('login', function() { |
| /** |
| * Event handler that is invoked just before the frame is shown. |
| - * @param data {string} Screen init payload. |
| + * @param {string} data Screen init payload. |
| */ |
| onBeforeShow: function(data) { |
| chrome.send('hideCaptivePortal'); |
| @@ -67,34 +67,31 @@ cr.define('login', function() { |
| var lockedPod = podRow.lockedPod; |
| $('add-user-header-bar-item').hidden = !!lockedPod; |
| $('sign-out-user-item').hidden = !lockedPod; |
| - if (lockedPod) { |
| - // TODO(altimofeev): empirically I investigated that focus isn't |
| - // set correctly if following CSS rules are present: |
| - // |
| - // podrow { |
| - // -webkit-transition: all 200ms ease-in-out; |
| - // } |
| - // .pod { |
| - // -webkit-transition: all 230ms ease; |
| - // } |
| - // |
| - // Workaround is either delete these rules or delay the focus setting. |
| - var self = this; |
| - lockedPod.addEventListener('webkitTransitionEnd', function f(e) { |
| - if (e.target == lockedPod) { |
| - podRow.focusPod(lockedPod); |
| - lockedPod.removeEventListener(f); |
| - // Delay the accountPickerReady signal so that if there are any |
| - // timeouts waiting to fire we can process these first. This was |
| - // causing crbug.com/112218 as the account pod was sometimes focuse |
| - // using focusPod (which resets the password) after the test code |
| - // set the password. |
| - self.onShow(); |
| - } |
| - }); |
| - } else { |
| - this.onShow(); |
| - } |
| + var preselectedPod = lockedPod || podRow.pods[0]; |
|
Nikita (slow)
2012/06/06 09:40:04
nit: Please add a boolean flag somewhere in here t
Ivan Korotkov
2012/06/06 10:59:24
Done.
|
| + // TODO(altimofeev): empirically I investigated that focus isn't |
| + // set correctly if following CSS rules are present: |
| + // |
| + // podrow { |
| + // -webkit-transition: all 200ms ease-in-out; |
| + // } |
| + // .pod { |
| + // -webkit-transition: all 230ms ease; |
| + // } |
| + // |
| + // Workaround is either delete these rules or delay the focus setting. |
| + var self = this; |
| + preselectedPod.addEventListener('webkitTransitionEnd', function f(e) { |
| + if (e.target == preselectedPod) { |
| + podRow.focusPod(preselectedPod); |
| + preselectedPod.removeEventListener(f); |
| + // Delay the accountPickerReady signal so that if there are any |
| + // timeouts waiting to fire we can process these first. This was |
| + // causing crbug.com/112218 as the account pod was sometimes focuse |
| + // using focusPod (which resets the password) after the test code |
| + // set the password. |
| + self.onShow(); |
| + } |
| + }); |
| }, |
| /** |
| @@ -114,7 +111,7 @@ cr.define('login', function() { |
| /** |
| * Event handler that is invoked just before the frame is hidden. |
| - * @param data {string} Screen init payload. |
| + * @param {string} data Screen init payload. |
| */ |
| onBeforeHide: function(data) { |
| $('pod-row').handleHide(); |
| @@ -142,7 +139,6 @@ cr.define('login', function() { |
| * Loads givens users in pod row. |
| * @param {array} users Array of user. |
| * @param {boolean} animated Whether to use init animation. |
| - * @public |
| */ |
| AccountPickerScreen.loadUsers = function(users, animated) { |
| $('pod-row').loadPods(users, animated); |
| @@ -151,7 +147,6 @@ cr.define('login', function() { |
| /** |
| * Updates current image of a user. |
| * @param {string} username User for which to update the image. |
| - * @public |
| */ |
| AccountPickerScreen.updateUserImage = function(username) { |
| $('pod-row').updateUserImage(username); |
| @@ -160,7 +155,6 @@ cr.define('login', function() { |
| /** |
| * Updates user to use gaia login. |
| * @param {string} username User for which to state the state. |
| - * @public |
| */ |
| AccountPickerScreen.updateUserGaiaNeeded = function(username) { |
| $('pod-row').resetUserOAuthTokenStatus(username); |
| @@ -169,7 +163,6 @@ cr.define('login', function() { |
| /** |
| * Updates Caps Lock state (for Caps Lock hint in password input field). |
| * @param {boolean} enabled Whether Caps Lock is on. |
| - * @public |
| */ |
| AccountPickerScreen.setCapsLockState = function(enabled) { |
| $('pod-row').classList[enabled ? 'add' : 'remove']('capslock-on'); |