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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 learnMore.addEventListener('mousedown', stopEventPropagation); | 1047 learnMore.addEventListener('mousedown', stopEventPropagation); |
1048 learnMore.addEventListener('click', this.handleLearnMoreEvent); | 1048 learnMore.addEventListener('click', this.handleLearnMoreEvent); |
1049 learnMore.addEventListener('keydown', this.handleLearnMoreEvent); | 1049 learnMore.addEventListener('keydown', this.handleLearnMoreEvent); |
1050 | 1050 |
1051 learnMore = this.querySelector('.expanded-pane-learn-more'); | 1051 learnMore = this.querySelector('.expanded-pane-learn-more'); |
1052 learnMore.addEventListener('click', this.handleLearnMoreEvent); | 1052 learnMore.addEventListener('click', this.handleLearnMoreEvent); |
1053 learnMore.addEventListener('keydown', this.handleLearnMoreEvent); | 1053 learnMore.addEventListener('keydown', this.handleLearnMoreEvent); |
1054 | 1054 |
1055 var languageSelect = this.querySelector('.language-select'); | 1055 var languageSelect = this.querySelector('.language-select'); |
1056 languageSelect.tabIndex = UserPodTabOrder.POD_INPUT; | 1056 languageSelect.tabIndex = UserPodTabOrder.POD_INPUT; |
1057 languageSelect.addEventListener('change', function() { | 1057 languageSelect.addEventListener( |
1058 chrome.send('getPublicSessionKeyboardLayouts', [ | 1058 'change', |
1059 this.user.username, | 1059 this.getPublicSessionKeyboardLayouts_.bind(this)); |
1060 languageSelect.options[languageSelect.selectedIndex].value]); | |
1061 }.bind(this)); | |
1062 | |
1063 this.querySelector('.keyboard-select').tabIndex = | 1060 this.querySelector('.keyboard-select').tabIndex = |
1064 UserPodTabOrder.POD_INPUT; | 1061 UserPodTabOrder.POD_INPUT; |
1065 | 1062 |
1066 var languageAndInput = this.querySelector('.language-and-input'); | 1063 var languageAndInput = this.querySelector('.language-and-input'); |
1067 languageAndInput.tabIndex = UserPodTabOrder.POD_INPUT; | 1064 languageAndInput.tabIndex = UserPodTabOrder.POD_INPUT; |
1068 languageAndInput.addEventListener('click', | 1065 languageAndInput.addEventListener('click', |
1069 this.transitionToAdvanced_.bind(this)); | 1066 this.transitionToAdvanced_.bind(this)); |
1070 | 1067 |
1071 this.enterButtonElement.addEventListener('click', (function(e) { | 1068 this.enterButtonElement.addEventListener('click', (function(e) { |
1072 this.enterButtonElement.disabled = true; | 1069 this.enterButtonElement.disabled = true; |
(...skipping 20 matching lines...) Expand all Loading... |
1093 languageSelect.appendChild(group); | 1090 languageSelect.appendChild(group); |
1094 } else { | 1091 } else { |
1095 group.appendChild( | 1092 group.appendChild( |
1096 new Option(item.title, item.value, item.selected, item.selected)); | 1093 new Option(item.title, item.value, item.selected, item.selected)); |
1097 } | 1094 } |
1098 } | 1095 } |
1099 | 1096 |
1100 id = this.user.username + '-keyboard'; | 1097 id = this.user.username + '-keyboard'; |
1101 this.querySelector('.keyboard-select-label').htmlFor = id; | 1098 this.querySelector('.keyboard-select-label').htmlFor = id; |
1102 this.querySelector('.keyboard-select').setAttribute('id', id); | 1099 this.querySelector('.keyboard-select').setAttribute('id', id); |
1103 this.populateKeyboardSelect_(this.user.initialKeyboardLayouts); | 1100 this.populateKeyboardSelect_([this.user.initialKeyboardLayout]); |
| 1101 this.getPublicSessionKeyboardLayouts_(); |
1104 }, | 1102 }, |
1105 | 1103 |
1106 /** @override **/ | 1104 /** @override **/ |
1107 update: function() { | 1105 update: function() { |
1108 UserPod.prototype.update.call(this); | 1106 UserPod.prototype.update.call(this); |
1109 this.querySelector('.expanded-pane-name').textContent = | 1107 this.querySelector('.expanded-pane-name').textContent = |
1110 this.user_.displayName; | 1108 this.user_.displayName; |
1111 this.querySelector('.info').textContent = | 1109 this.querySelector('.info').textContent = |
1112 loadTimeData.getStringF('publicAccountInfoFormat', | 1110 loadTimeData.getStringF('publicAccountInfoFormat', |
1113 this.user_.enterpriseDomain); | 1111 this.user_.enterpriseDomain); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 observer); | 1203 observer); |
1206 pod.classList.remove('transitioning-to-advanced'); | 1204 pod.classList.remove('transitioning-to-advanced'); |
1207 pod.querySelector('.language-select').focus(); | 1205 pod.querySelector('.language-select').focus(); |
1208 }); | 1206 }); |
1209 // Guard timer set to animation duration + 20ms. | 1207 // Guard timer set to animation duration + 20ms. |
1210 ensureTransitionEndEvent(languageAndInputSection, 380); | 1208 ensureTransitionEndEvent(languageAndInputSection, 380); |
1211 }, 0); | 1209 }, 0); |
1212 }, | 1210 }, |
1213 | 1211 |
1214 /** | 1212 /** |
| 1213 * Retrieves the list of keyboard layouts available for the currently |
| 1214 * selected locale. |
| 1215 */ |
| 1216 getPublicSessionKeyboardLayouts_: function() { |
| 1217 var languageSelect = this.querySelector('.language-select'); |
| 1218 chrome.send('getPublicSessionKeyboardLayouts', [ |
| 1219 this.user.username, |
| 1220 languageSelect.options[languageSelect.selectedIndex].value]); |
| 1221 }, |
| 1222 |
| 1223 /** |
1215 * Populates the keyboard layout "select" element with a list of layouts. | 1224 * Populates the keyboard layout "select" element with a list of layouts. |
1216 * @param {!Object} list List of available keyboard layouts | 1225 * @param {!Object} list List of available keyboard layouts |
1217 */ | 1226 */ |
1218 populateKeyboardSelect_: function(list) { | 1227 populateKeyboardSelect_: function(list) { |
1219 var keyboardSelect = this.querySelector('.keyboard-select'); | 1228 var keyboardSelect = this.querySelector('.keyboard-select'); |
1220 keyboardSelect.innerHTML = ''; | 1229 keyboardSelect.innerHTML = ''; |
1221 for (var i = 0; i < list.length; ++i) { | 1230 for (var i = 0; i < list.length; ++i) { |
1222 var item = list[i]; | 1231 var item = list[i]; |
1223 keyboardSelect.appendChild( | 1232 keyboardSelect.appendChild( |
1224 new Option(item.title, item.value, item.selected, item.selected)); | 1233 new Option(item.title, item.value, item.selected, item.selected)); |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 if (this.podsWithPendingImages_.length == 0) { | 2398 if (this.podsWithPendingImages_.length == 0) { |
2390 this.classList.remove('images-loading'); | 2399 this.classList.remove('images-loading'); |
2391 } | 2400 } |
2392 } | 2401 } |
2393 }; | 2402 }; |
2394 | 2403 |
2395 return { | 2404 return { |
2396 PodRow: PodRow | 2405 PodRow: PodRow |
2397 }; | 2406 }; |
2398 }); | 2407 }); |
OLD | NEW |