OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Account picker screen implementation. | 6 * @fileoverview Account picker screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('AccountPickerScreen', 'account-picker', function() { | 9 login.createScreen('AccountPickerScreen', 'account-picker', function() { |
10 /** | 10 /** |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 [activatedPod.user.emailAddress]); | 173 [activatedPod.user.emailAddress]); |
174 activatedPod.showSigninUI(); | 174 activatedPod.showSigninUI(); |
175 } else { | 175 } else { |
176 if (loginAttempts == 1) { | 176 if (loginAttempts == 1) { |
177 chrome.send('firstIncorrectPasswordAttempt', | 177 chrome.send('firstIncorrectPasswordAttempt', |
178 [activatedPod.user.emailAddress]); | 178 [activatedPod.user.emailAddress]); |
179 } | 179 } |
180 // We want bubble's arrow to point to the first letter of input. | 180 // We want bubble's arrow to point to the first letter of input. |
181 /** @const */ var BUBBLE_OFFSET = 7; | 181 /** @const */ var BUBBLE_OFFSET = 7; |
182 /** @const */ var BUBBLE_PADDING = 4; | 182 /** @const */ var BUBBLE_PADDING = 4; |
183 $('bubble').showContentForElement(activatedPod.mainInput, | 183 |
184 cr.ui.Bubble.Attachment.BOTTOM, | 184 // We want the bubble to point to where the input is after it is done |
185 error, | 185 // tranisitioning. |
186 BUBBLE_OFFSET, BUBBLE_PADDING); | 186 var showBottomCallback = function() { |
| 187 activatedPod.removeEventListener("webkitTransitionEnd", |
| 188 showBottomCallback); |
| 189 $('bubble').showContentForElement(activatedPod.mainInput, |
| 190 cr.ui.Bubble.Attachment.BOTTOM, |
| 191 error, |
| 192 BUBBLE_OFFSET, BUBBLE_PADDING); |
| 193 }; |
| 194 activatedPod.addEventListener("webkitTransitionEnd", |
| 195 showBottomCallback); |
| 196 ensureTransitionEndEvent(activatedPod); |
| 197 |
187 // Move error bubble up if it overlaps the shelf. | 198 // Move error bubble up if it overlaps the shelf. |
188 var maxHeight = | 199 var maxHeight = |
189 cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping($('bubble')); | 200 cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping($('bubble')); |
190 if (maxHeight < $('bubble').offsetHeight) { | 201 if (maxHeight < $('bubble').offsetHeight) { |
191 $('bubble').showContentForElement(activatedPod.mainInput, | 202 var showTopCallback = function() { |
192 cr.ui.Bubble.Attachment.TOP, | 203 activatedPod.removeEventListener("webkitTransitionEnd", |
193 error, | 204 showTopCallback); |
194 BUBBLE_OFFSET, BUBBLE_PADDING); | 205 $('bubble').showContentForElement(activatedPod.mainInput, |
| 206 cr.ui.Bubble.Attachment.TOP, |
| 207 error, |
| 208 BUBBLE_OFFSET, BUBBLE_PADDING); |
| 209 }; |
| 210 activatedPod.addEventListener("webkitTransitionEnd", showTopCallback); |
| 211 ensureTransitionEndEvent(activatedPod); |
195 } | 212 } |
196 } | 213 } |
197 }, | 214 }, |
198 | 215 |
199 /** | 216 /** |
200 * Loads the PIN keyboard if any of the users can login with a PIN. | 217 * Loads the PIN keyboard if any of the users can login with a PIN. |
201 * @param {array} users Array of user instances. | 218 * @param {array} users Array of user instances. |
202 */ | 219 */ |
203 loadPinKeyboardIfNeeded_: function(users) { | 220 loadPinKeyboardIfNeeded_: function(users) { |
204 for (var i = 0; i < users.length; ++i) { | 221 for (var i = 0; i < users.length; ++i) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 365 |
349 /** | 366 /** |
350 * Sets the state of touch view mode. | 367 * Sets the state of touch view mode. |
351 * @param {boolean} isTouchViewEnabled true if the mode is on. | 368 * @param {boolean} isTouchViewEnabled true if the mode is on. |
352 */ | 369 */ |
353 setTouchViewState: function(isTouchViewEnabled) { | 370 setTouchViewState: function(isTouchViewEnabled) { |
354 $('pod-row').setTouchViewState(isTouchViewEnabled); | 371 $('pod-row').setTouchViewState(isTouchViewEnabled); |
355 }, | 372 }, |
356 | 373 |
357 /** | 374 /** |
358 * Hides the PIN keyboard if it's active. | 375 * Removes the PIN keyboard so the user can no longer enter a PIN. |
359 * @param {!user} user The user who can no longer enter a PIN. | 376 * @param {!user} user The user who can no longer enter a PIN. |
360 */ | 377 */ |
361 disablePinKeyboardForUser: function(user) { | 378 disablePinKeyboardForUser: function(user) { |
362 $('pod-row').setPinVisibility(user, false); | 379 $('pod-row').removePinKeyboard(user); |
363 }, | 380 }, |
364 | 381 |
365 /** | 382 /** |
366 * Updates the display name shown on a public session pod. | 383 * Updates the display name shown on a public session pod. |
367 * @param {string} userID The user ID of the public session | 384 * @param {string} userID The user ID of the public session |
368 * @param {string} displayName The new display name | 385 * @param {string} displayName The new display name |
369 */ | 386 */ |
370 setPublicSessionDisplayName: function(userID, displayName) { | 387 setPublicSessionDisplayName: function(userID, displayName) { |
371 $('pod-row').setPublicSessionDisplayName(userID, displayName); | 388 $('pod-row').setPublicSessionDisplayName(userID, displayName); |
372 }, | 389 }, |
(...skipping 21 matching lines...) Expand all Loading... |
394 * @param {string} userID The user ID of the public session | 411 * @param {string} userID The user ID of the public session |
395 * @param {string} locale The locale to which this list of keyboard layouts | 412 * @param {string} locale The locale to which this list of keyboard layouts |
396 * applies | 413 * applies |
397 * @param {!Object} list List of available keyboard layouts | 414 * @param {!Object} list List of available keyboard layouts |
398 */ | 415 */ |
399 setPublicSessionKeyboardLayouts: function(userID, locale, list) { | 416 setPublicSessionKeyboardLayouts: function(userID, locale, list) { |
400 $('pod-row').setPublicSessionKeyboardLayouts(userID, locale, list); | 417 $('pod-row').setPublicSessionKeyboardLayouts(userID, locale, list); |
401 } | 418 } |
402 }; | 419 }; |
403 }); | 420 }); |
OLD | NEW |