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