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 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 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 if (this.parentNode.disabled) | 1154 if (this.parentNode.disabled) |
1155 return; | 1155 return; |
1156 | 1156 |
1157 this.parentNode.focusPod(this); | 1157 this.parentNode.focusPod(this); |
1158 this.parentNode.setActivatedPod(this, e); | 1158 this.parentNode.setActivatedPod(this, e); |
1159 // Prevent default so that we don't trigger 'focus' event. | 1159 // Prevent default so that we don't trigger 'focus' event. |
1160 e.preventDefault(); | 1160 e.preventDefault(); |
1161 }, | 1161 }, |
1162 | 1162 |
1163 /** | 1163 /** |
| 1164 * Updates the display name shown on the pod. |
| 1165 * @param {string} displayName The new display name |
| 1166 */ |
| 1167 setDisplayName: function(displayName) { |
| 1168 this.user_.displayName = displayName; |
| 1169 this.update(); |
| 1170 }, |
| 1171 |
| 1172 /** |
1164 * Handle mouse and keyboard events for the learn more button. Triggering | 1173 * Handle mouse and keyboard events for the learn more button. Triggering |
1165 * the button causes information about public sessions to be shown. | 1174 * the button causes information about public sessions to be shown. |
1166 * @param {Event} event Mouse or keyboard event. | 1175 * @param {Event} event Mouse or keyboard event. |
1167 */ | 1176 */ |
1168 handleLearnMoreEvent: function(event) { | 1177 handleLearnMoreEvent: function(event) { |
1169 switch (event.type) { | 1178 switch (event.type) { |
1170 // Show informaton on left click. Let any other clicks propagate. | 1179 // Show informaton on left click. Let any other clicks propagate. |
1171 case 'click': | 1180 case 'click': |
1172 if (event.button != 0) | 1181 if (event.button != 0) |
1173 return; | 1182 return; |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 /** @const */ var BUBBLE_OFFSET = 20; | 1843 /** @const */ var BUBBLE_OFFSET = 20; |
1835 /** @const */ var BUBBLE_PADDING = 8; | 1844 /** @const */ var BUBBLE_PADDING = 8; |
1836 $('bubble').showContentForElement(attachElement, | 1845 $('bubble').showContentForElement(attachElement, |
1837 cr.ui.Bubble.Attachment.RIGHT, | 1846 cr.ui.Bubble.Attachment.RIGHT, |
1838 bubbleContent, | 1847 bubbleContent, |
1839 BUBBLE_OFFSET, | 1848 BUBBLE_OFFSET, |
1840 BUBBLE_PADDING); | 1849 BUBBLE_PADDING); |
1841 }, | 1850 }, |
1842 | 1851 |
1843 /** | 1852 /** |
| 1853 * Updates the display name shown on a public session pod. |
| 1854 * @param {string} userID The user ID of the public session |
| 1855 * @param {string} displayName The new display name |
| 1856 */ |
| 1857 setPublicSessionDisplayName: function(userID, displayName) { |
| 1858 var pod = this.getPodWithUsername_(userID); |
| 1859 if (pod != null) |
| 1860 pod.setDisplayName(displayName); |
| 1861 }, |
| 1862 |
| 1863 /** |
1844 * Updates the list of available keyboard layouts for a public session pod. | 1864 * Updates the list of available keyboard layouts for a public session pod. |
1845 * @param {string} userID The user ID of the public session | 1865 * @param {string} userID The user ID of the public session |
1846 * @param {!Object} list List of available keyboard layouts | 1866 * @param {!Object} list List of available keyboard layouts |
1847 */ | 1867 */ |
1848 setPublicSessionKeyboardLayouts: function(userID, list) { | 1868 setPublicSessionKeyboardLayouts: function(userID, list) { |
1849 var pod = this.getPodWithUsername_(userID); | 1869 var pod = this.getPodWithUsername_(userID); |
1850 if (pod != null) | 1870 if (pod != null) |
1851 pod.populateKeyboardSelect_(list); | 1871 pod.populateKeyboardSelect_(list); |
1852 }, | 1872 }, |
1853 | 1873 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2411 if (this.podsWithPendingImages_.length == 0) { | 2431 if (this.podsWithPendingImages_.length == 0) { |
2412 this.classList.remove('images-loading'); | 2432 this.classList.remove('images-loading'); |
2413 } | 2433 } |
2414 } | 2434 } |
2415 }; | 2435 }; |
2416 | 2436 |
2417 return { | 2437 return { |
2418 PodRow: PodRow | 2438 PodRow: PodRow |
2419 }; | 2439 }; |
2420 }); | 2440 }); |
OLD | NEW |