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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 $('pod-row').classList.remove('images-loading'); | 1110 $('pod-row').classList.remove('images-loading'); |
1111 }, POD_ROW_IMAGES_LOAD_TIMEOUT_MS); | 1111 }, POD_ROW_IMAGES_LOAD_TIMEOUT_MS); |
1112 | 1112 |
1113 var columns = users.length < COLUMNS.length ? | 1113 var columns = users.length < COLUMNS.length ? |
1114 COLUMNS[users.length] : COLUMNS[COLUMNS.length - 1]; | 1114 COLUMNS[users.length] : COLUMNS[COLUMNS.length - 1]; |
1115 var rows = Math.floor((users.length - 1) / columns) + 1; | 1115 var rows = Math.floor((users.length - 1) / columns) + 1; |
1116 | 1116 |
1117 // Cancel any pending resize operation. | 1117 // Cancel any pending resize operation. |
1118 this.removeEventListener('mouseout', this.deferredResizeListener_); | 1118 this.removeEventListener('mouseout', this.deferredResizeListener_); |
1119 | 1119 |
| 1120 // If this pod row is used in the desktop user manager, we need to |
| 1121 // force a resize, as it may be a background window which won't get a |
| 1122 // mouseout event for a while; the pods would be displayed incorrectly |
| 1123 // until then. |
| 1124 if (this.preselectedPod.user.isDesktopUser) |
| 1125 this.resize_(columns, rows); |
| 1126 |
1120 if (!this.columns || !this.rows) { | 1127 if (!this.columns || !this.rows) { |
1121 // Set initial dimensions. | 1128 // Set initial dimensions. |
1122 this.resize_(columns, rows); | 1129 this.resize_(columns, rows); |
1123 } else if (columns != this.columns || rows != this.rows) { | 1130 } else if (columns != this.columns || rows != this.rows) { |
1124 // Defer the resize until mouse cursor leaves the pod row. | 1131 // Defer the resize until mouse cursor leaves the pod row. |
1125 this.deferredResizeListener_ = function(e) { | 1132 this.deferredResizeListener_ = function(e) { |
1126 if (!findAncestorByClass(e.toElement, 'podrow')) { | 1133 if (!findAncestorByClass(e.toElement, 'podrow')) { |
1127 this.resize_(columns, rows); | 1134 this.resize_(columns, rows); |
1128 } | 1135 } |
1129 }.bind(this); | 1136 }.bind(this); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 if (this.podsWithPendingImages_.length == 0) { | 1572 if (this.podsWithPendingImages_.length == 0) { |
1566 this.classList.remove('images-loading'); | 1573 this.classList.remove('images-loading'); |
1567 } | 1574 } |
1568 } | 1575 } |
1569 }; | 1576 }; |
1570 | 1577 |
1571 return { | 1578 return { |
1572 PodRow: PodRow | 1579 PodRow: PodRow |
1573 }; | 1580 }; |
1574 }); | 1581 }); |
OLD | NEW |