Chromium Code Reviews| 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 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2085 | 2085 |
| 2086 var keyboardSelect = this.querySelector('.keyboard-select'); | 2086 var keyboardSelect = this.querySelector('.keyboard-select'); |
| 2087 keyboardSelect.tabIndex = UserPodTabOrder.POD_INPUT; | 2087 keyboardSelect.tabIndex = UserPodTabOrder.POD_INPUT; |
| 2088 keyboardSelect.loadedLocale = null; | 2088 keyboardSelect.loadedLocale = null; |
| 2089 | 2089 |
| 2090 var languageAndInput = this.querySelector('.language-and-input'); | 2090 var languageAndInput = this.querySelector('.language-and-input'); |
| 2091 languageAndInput.tabIndex = UserPodTabOrder.POD_INPUT; | 2091 languageAndInput.tabIndex = UserPodTabOrder.POD_INPUT; |
| 2092 languageAndInput.addEventListener('click', | 2092 languageAndInput.addEventListener('click', |
| 2093 this.transitionToAdvanced_.bind(this)); | 2093 this.transitionToAdvanced_.bind(this)); |
| 2094 | 2094 |
| 2095 var monitoringLearnMore = this.querySelector('.monitoring-learn-more'); | |
| 2096 monitoringLearnMore.tabIndex = UserPodTabOrder.POD_INPUT; | |
| 2097 monitoringLearnMore.addEventListener( | |
| 2098 'click', this.onMonitoringLearnMoreClicked_.bind(this)); | |
| 2099 | |
| 2095 this.enterButtonElement.addEventListener('click', (function(e) { | 2100 this.enterButtonElement.addEventListener('click', (function(e) { |
| 2096 this.enterButtonElement.disabled = true; | 2101 this.enterButtonElement.disabled = true; |
| 2097 var locale = this.querySelector('.language-select').value; | 2102 var locale = this.querySelector('.language-select').value; |
| 2098 var keyboardSelect = this.querySelector('.keyboard-select'); | 2103 var keyboardSelect = this.querySelector('.keyboard-select'); |
| 2099 // The contents of |keyboardSelect| is updated asynchronously. If its | 2104 // The contents of |keyboardSelect| is updated asynchronously. If its |
| 2100 // locale does not match |locale|, it has not updated yet and the | 2105 // locale does not match |locale|, it has not updated yet and the |
| 2101 // currently selected keyboard layout may not be applicable to |locale|. | 2106 // currently selected keyboard layout may not be applicable to |locale|. |
| 2102 // Do not return any keyboard layout in this case and let the backend | 2107 // Do not return any keyboard layout in this case and let the backend |
| 2103 // choose a suitable layout. | 2108 // choose a suitable layout. |
| 2104 var keyboardLayout = | 2109 var keyboardLayout = |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2236 observer); | 2241 observer); |
| 2237 pod.classList.remove('transitioning-to-advanced'); | 2242 pod.classList.remove('transitioning-to-advanced'); |
| 2238 pod.querySelector('.language-select').focus(); | 2243 pod.querySelector('.language-select').focus(); |
| 2239 }); | 2244 }); |
| 2240 // Guard timer set to animation duration + 20ms. | 2245 // Guard timer set to animation duration + 20ms. |
| 2241 ensureTransitionEndEvent(languageAndInputSection, 380); | 2246 ensureTransitionEndEvent(languageAndInputSection, 380); |
| 2242 }, 0); | 2247 }, 0); |
| 2243 }, | 2248 }, |
| 2244 | 2249 |
| 2245 /** | 2250 /** |
| 2251 * Show a dialog when user clicks on learn more (monitoring) button. | |
| 2252 */ | |
| 2253 onMonitoringLearnMoreClicked_: function() { | |
| 2254 var dialogContainer = document.createElement('div'); | |
|
xiyuan
2016/11/23 00:23:07
nit: Cache the container div to avoid creating it
Ivan Šandrk
2016/11/23 10:42:11
Done.
| |
| 2255 dialogContainer.classList.add('monitoring-dialog-container'); | |
| 2256 document.querySelector('#scroll-container').appendChild(dialogContainer); | |
| 2257 // Public Session POD in advanced view has a different size so add a dummy | |
| 2258 // parent element to enable different CSS settings. | |
| 2259 if (this.classList.contains('advanced')) { | |
| 2260 dialogContainer.classList.add('advanced'); | |
| 2261 } | |
| 2262 var html = ''; | |
| 2263 var infoItems = ['publicAccountMonitoringInfoItem1', | |
| 2264 'publicAccountMonitoringInfoItem2', | |
| 2265 'publicAccountMonitoringInfoItem3', | |
| 2266 'publicAccountMonitoringInfoItem4']; | |
| 2267 for (item of infoItems) { | |
| 2268 html += '<p class="cr-dialog-item">'; | |
| 2269 html += loadTimeData.getString(item); | |
| 2270 html += '</p>'; | |
| 2271 } | |
| 2272 var title = loadTimeData.getString('publicAccountMonitoringInfo'); | |
| 2273 this.dialog_ = new cr.ui.dialogs.BaseDialog(dialogContainer); | |
| 2274 this.dialog_.showHtml(title, html, undefined, | |
| 2275 this.onMonitoringDialogClosed_.bind(this)); | |
| 2276 document.querySelector('#pod-row').disabled = true; | |
|
xiyuan
2016/11/23 00:23:07
nit: replace
document.querySelector('#pod-row')
Ivan Šandrk
2016/11/23 10:42:11
Done.
| |
| 2277 }, | |
| 2278 | |
| 2279 /** | |
| 2280 * Cleanup after the monitoring warning dialog is closed. | |
| 2281 */ | |
| 2282 onMonitoringDialogClosed_: function() { | |
| 2283 document.querySelector('#pod-row').disabled = false; | |
|
xiyuan
2016/11/23 00:23:07
nit: document.querySelector('#pod-row') -> this.pa
Ivan Šandrk
2016/11/23 10:42:11
Done.
| |
| 2284 this.dialog_ = undefined; | |
| 2285 }, | |
| 2286 | |
| 2287 /** | |
| 2246 * Retrieves the list of keyboard layouts available for the currently | 2288 * Retrieves the list of keyboard layouts available for the currently |
| 2247 * selected locale. | 2289 * selected locale. |
| 2248 */ | 2290 */ |
| 2249 getPublicSessionKeyboardLayouts_: function() { | 2291 getPublicSessionKeyboardLayouts_: function() { |
| 2250 var selectedLocale = this.querySelector('.language-select').value; | 2292 var selectedLocale = this.querySelector('.language-select').value; |
| 2251 if (selectedLocale == | 2293 if (selectedLocale == |
| 2252 this.querySelector('.keyboard-select').loadedLocale) { | 2294 this.querySelector('.keyboard-select').loadedLocale) { |
| 2253 // If the list of keyboard layouts was loaded for the currently selected | 2295 // If the list of keyboard layouts was loaded for the currently selected |
| 2254 // locale, it is already up to date. | 2296 // locale, it is already up to date. |
| 2255 return; | 2297 return; |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3681 if (pod && pod.multiProfilesPolicyApplied) { | 3723 if (pod && pod.multiProfilesPolicyApplied) { |
| 3682 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3724 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3683 } | 3725 } |
| 3684 } | 3726 } |
| 3685 }; | 3727 }; |
| 3686 | 3728 |
| 3687 return { | 3729 return { |
| 3688 PodRow: PodRow | 3730 PodRow: PodRow |
| 3689 }; | 3731 }; |
| 3690 }); | 3732 }); |
| OLD | NEW |