| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Update the pod row display if incorrect password. | 191 // Update the pod row display if incorrect password. |
| 192 $('pod-row').setFocusedPodErrorDisplay(true); | 192 $('pod-row').setFocusedPodErrorDisplay(true); |
| 193 | 193 |
| 194 /** @const */ var BUBBLE_OFFSET = 25; | 194 /** @const */ var BUBBLE_OFFSET = 25; |
| 195 // -8 = 4(BUBBLE_POD_OFFSET) - 2(bubble margin) | 195 // -8 = 4(BUBBLE_POD_OFFSET) - 2(bubble margin) |
| 196 // - 10(internal bubble adjustment) | 196 // - 10(internal bubble adjustment) |
| 197 var bubblePositioningPadding = -8; | 197 var bubblePositioningPadding = -8; |
| 198 | 198 |
| 199 var bubbleAnchor; | 199 var bubbleAnchor; |
| 200 var attachment; | 200 var attachment; |
| 201 if (activatedPod.pinContainer) { | 201 // Anchor the bubble to the input field. |
| 202 // Anchor the bubble to the input field. | 202 bubbleAnchor = |
| 203 bubbleAnchor = ( | 203 activatedPod.getElementsByClassName('auth-container')[0]; |
| 204 activatedPod.getElementsByClassName('auth-container'))[0]; | 204 if (!bubbleAnchor) { |
| 205 if (!bubbleAnchor) { | 205 console.error('auth-container not found!'); |
| 206 console.error('auth-container not found!'); | 206 bubbleAnchor = activatedPod.mainInput; |
| 207 bubbleAnchor = activatedPod.mainInput; | 207 } |
| 208 } | 208 if (activatedPod.pinContainer && |
| 209 activatedPod.pinContainer.style.visibility == 'visible') |
| 209 attachment = cr.ui.Bubble.Attachment.RIGHT; | 210 attachment = cr.ui.Bubble.Attachment.RIGHT; |
| 210 } else { | 211 else |
| 211 // Anchor the bubble to the pod instead of the input. | |
| 212 bubbleAnchor = activatedPod; | |
| 213 attachment = cr.ui.Bubble.Attachment.BOTTOM; | 212 attachment = cr.ui.Bubble.Attachment.BOTTOM; |
| 214 } | |
| 215 | 213 |
| 216 var bubble = $('bubble'); | 214 var bubble = $('bubble'); |
| 217 | 215 |
| 218 // Cannot use cr.ui.LoginUITools.get* on bubble until it is attached to | 216 // Cannot use cr.ui.LoginUITools.get* on bubble until it is attached to |
| 219 // the element. getMaxHeight/Width rely on the correct up/left element | 217 // the element. getMaxHeight/Width rely on the correct up/left element |
| 220 // side positioning that doesn't happen until bubble is attached. | 218 // side positioning that doesn't happen until bubble is attached. |
| 221 var maxHeight = | 219 var maxHeight = |
| 222 cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping(bubbleAnchor) | 220 cr.ui.LoginUITools.getMaxHeightBeforeShelfOverlapping(bubbleAnchor) |
| 223 - bubbleAnchor.offsetHeight - BUBBLE_POD_OFFSET; | 221 - bubbleAnchor.offsetHeight - BUBBLE_POD_OFFSET; |
| 224 var maxWidth = cr.ui.LoginUITools.getMaxWidthToFit(bubbleAnchor) | 222 var maxWidth = cr.ui.LoginUITools.getMaxWidthToFit(bubbleAnchor) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 * @param {string} userID The user ID of the public session | 465 * @param {string} userID The user ID of the public session |
| 468 * @param {string} locale The locale to which this list of keyboard layouts | 466 * @param {string} locale The locale to which this list of keyboard layouts |
| 469 * applies | 467 * applies |
| 470 * @param {!Object} list List of available keyboard layouts | 468 * @param {!Object} list List of available keyboard layouts |
| 471 */ | 469 */ |
| 472 setPublicSessionKeyboardLayouts: function(userID, locale, list) { | 470 setPublicSessionKeyboardLayouts: function(userID, locale, list) { |
| 473 $('pod-row').setPublicSessionKeyboardLayouts(userID, locale, list); | 471 $('pod-row').setPublicSessionKeyboardLayouts(userID, locale, list); |
| 474 } | 472 } |
| 475 }; | 473 }; |
| 476 }); | 474 }); |
| OLD | NEW |