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