| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 /** | 795 /** |
| 796 * Initializes the pod after its properties set and added to a pod row. | 796 * Initializes the pod after its properties set and added to a pod row. |
| 797 */ | 797 */ |
| 798 initialize: function() { | 798 initialize: function() { |
| 799 this.passwordElement.addEventListener('keydown', | 799 this.passwordElement.addEventListener('keydown', |
| 800 this.parentNode.handleKeyDown.bind(this.parentNode)); | 800 this.parentNode.handleKeyDown.bind(this.parentNode)); |
| 801 this.passwordElement.addEventListener('keypress', | 801 this.passwordElement.addEventListener('keypress', |
| 802 this.handlePasswordKeyPress_.bind(this)); | 802 this.handlePasswordKeyPress_.bind(this)); |
| 803 this.passwordElement.addEventListener('input', | 803 this.passwordElement.addEventListener('input', |
| 804 this.handleInputChanged_.bind(this)); | 804 this.handleInputChanged_.bind(this)); |
| 805 this.passwordElement.addEventListener('mouseup', | |
| 806 this.handleInputMouseUp_.bind(this)); | |
| 807 | 805 |
| 808 if (this.submitButton) { | 806 if (this.submitButton) { |
| 809 this.submitButton.addEventListener('click', | 807 this.submitButton.addEventListener('click', |
| 810 this.handleSubmitButtonClick_.bind(this)); | 808 this.handleSubmitButtonClick_.bind(this)); |
| 811 } | 809 } |
| 812 | 810 |
| 813 this.imageElement.addEventListener('load', | 811 this.imageElement.addEventListener('load', |
| 814 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); | 812 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| 815 | 813 |
| 816 this.smallPodImageElement.addEventListener( | 814 this.smallPodImageElement.addEventListener( |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 // Set the focus to the input element after showing/hiding pin keyboard. | 1305 // Set the focus to the input element after showing/hiding pin keyboard. |
| 1308 this.mainInput.focus(); | 1306 this.mainInput.focus(); |
| 1309 | 1307 |
| 1310 // Change the password placeholder based on pin keyboard visibility. | 1308 // Change the password placeholder based on pin keyboard visibility. |
| 1311 this.passwordElement.placeholder = loadTimeData.getString(visible ? | 1309 this.passwordElement.placeholder = loadTimeData.getString(visible ? |
| 1312 'pinKeyboardPlaceholderPinPassword' : 'passwordHint'); | 1310 'pinKeyboardPlaceholderPinPassword' : 'passwordHint'); |
| 1313 | 1311 |
| 1314 // Adjust the vertical position based on the pin keyboard visibility. | 1312 // Adjust the vertical position based on the pin keyboard visibility. |
| 1315 var podHeight = visible ? CROS_POD_HEIGHT_WITH_PIN : CROS_POD_HEIGHT; | 1313 var podHeight = visible ? CROS_POD_HEIGHT_WITH_PIN : CROS_POD_HEIGHT; |
| 1316 this.top = ($('pod-row').screenSize.height - podHeight) / 2; | 1314 this.top = ($('pod-row').screenSize.height - podHeight) / 2; |
| 1317 | |
| 1318 chrome.send('setForceDisableVirtualKeyboard', [visible]); | |
| 1319 }, | 1315 }, |
| 1320 | 1316 |
| 1321 isPinShown: function() { | 1317 isPinShown: function() { |
| 1322 return this.classList.contains('pin-enabled'); | 1318 return this.classList.contains('pin-enabled'); |
| 1323 }, | 1319 }, |
| 1324 | 1320 |
| 1325 setUserPodIconType: function(userTypeClass) { | 1321 setUserPodIconType: function(userTypeClass) { |
| 1326 this.userTypeIconAreaElement.classList.add(userTypeClass); | 1322 this.userTypeIconAreaElement.classList.add(userTypeClass); |
| 1327 // TODO(wzang): Evaluate all icon types other than supervised user and | 1323 // TODO(wzang): Evaluate all icon types other than supervised user and |
| 1328 // switch them to badges per the design spec. | 1324 // switch them to badges per the design spec. |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 | 2065 |
| 2070 /** | 2066 /** |
| 2071 * Handles input event on the password element. | 2067 * Handles input event on the password element. |
| 2072 * @param {Event} e Input event. | 2068 * @param {Event} e Input event. |
| 2073 */ | 2069 */ |
| 2074 handleInputChanged_: function(e) { | 2070 handleInputChanged_: function(e) { |
| 2075 this.updateInput_(); | 2071 this.updateInput_(); |
| 2076 }, | 2072 }, |
| 2077 | 2073 |
| 2078 /** | 2074 /** |
| 2079 * Handles mouse up event on the password element. | |
| 2080 * @param {Event} e Mouse up event. | |
| 2081 */ | |
| 2082 handleInputMouseUp_: function(e) { | |
| 2083 // If the PIN keyboard is shown and the user clicks on the password | |
| 2084 // element, the virtual keyboard should pop up if it is enabled, so we | |
| 2085 // must disable the virtual keyboard override. | |
| 2086 if (this.isPinShown()) { | |
| 2087 chrome.send('setForceDisableVirtualKeyboard', [false]); | |
| 2088 } | |
| 2089 }, | |
| 2090 | |
| 2091 /** | |
| 2092 * Handles click event on a user pod. | 2075 * Handles click event on a user pod. |
| 2093 * @param {Event} e Click event. | 2076 * @param {Event} e Click event. |
| 2094 */ | 2077 */ |
| 2095 handleClickOnPod_: function(e) { | 2078 handleClickOnPod_: function(e) { |
| 2096 if (this.parentNode.disabled) | 2079 if (this.parentNode.disabled) |
| 2097 return; | 2080 return; |
| 2098 | 2081 |
| 2099 // Click events on public session pods should only be handled by their | 2082 // Click events on public session pods should only be handled by their |
| 2100 // overriding handler. | 2083 // overriding handler. |
| 2101 if (this.isPublicSessionPod) | 2084 if (this.isPublicSessionPod) |
| (...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4573 if (pod && pod.multiProfilesPolicyApplied) { | 4556 if (pod && pod.multiProfilesPolicyApplied) { |
| 4574 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 4557 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 4575 } | 4558 } |
| 4576 } | 4559 } |
| 4577 }; | 4560 }; |
| 4578 | 4561 |
| 4579 return { | 4562 return { |
| 4580 PodRow: PodRow | 4563 PodRow: PodRow |
| 4581 }; | 4564 }; |
| 4582 }); | 4565 }); |
| OLD | NEW |