| 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 /** @override */ | 707 /** @override */ |
| 708 decorate: function() { | 708 decorate: function() { |
| 709 this.tabIndex = UserPodTabOrder.POD_INPUT; | 709 this.tabIndex = UserPodTabOrder.POD_INPUT; |
| 710 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.POD_INPUT; | 710 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.POD_INPUT; |
| 711 | 711 |
| 712 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this)); | 712 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this)); |
| 713 this.addEventListener('click', this.handleClickOnPod_.bind(this)); | 713 this.addEventListener('click', this.handleClickOnPod_.bind(this)); |
| 714 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this)); | 714 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this)); |
| 715 | 715 |
| 716 if (this.pinKeyboard) { | 716 if (this.pinKeyboard) { |
| 717 this.pinKeyboard.passwordElement = this.passwordElement; |
| 717 this.pinKeyboard.addEventListener('pin-change', | 718 this.pinKeyboard.addEventListener('pin-change', |
| 718 this.handlePinChanged_.bind(this)); | 719 this.handleInputChanged_.bind(this)); |
| 719 } | 720 } |
| 720 | 721 |
| 721 this.actionBoxAreaElement.addEventListener('mousedown', | 722 this.actionBoxAreaElement.addEventListener('mousedown', |
| 722 stopEventPropagation); | 723 stopEventPropagation); |
| 723 this.actionBoxAreaElement.addEventListener('click', | 724 this.actionBoxAreaElement.addEventListener('click', |
| 724 this.handleActionAreaButtonClick_.bind(this)); | 725 this.handleActionAreaButtonClick_.bind(this)); |
| 725 this.actionBoxAreaElement.addEventListener('keydown', | 726 this.actionBoxAreaElement.addEventListener('keydown', |
| 726 this.handleActionAreaButtonKeyDown_.bind(this)); | 727 this.handleActionAreaButtonKeyDown_.bind(this)); |
| 727 | 728 |
| 728 this.actionBoxMenuTitleElement.addEventListener('keydown', | 729 this.actionBoxMenuTitleElement.addEventListener('keydown', |
| (...skipping 19 matching lines...) Expand all Loading... |
| 748 /** | 749 /** |
| 749 * Initializes the pod after its properties set and added to a pod row. | 750 * Initializes the pod after its properties set and added to a pod row. |
| 750 */ | 751 */ |
| 751 initialize: function() { | 752 initialize: function() { |
| 752 this.passwordElement.addEventListener('keydown', | 753 this.passwordElement.addEventListener('keydown', |
| 753 this.parentNode.handleKeyDown.bind(this.parentNode)); | 754 this.parentNode.handleKeyDown.bind(this.parentNode)); |
| 754 this.passwordElement.addEventListener('keypress', | 755 this.passwordElement.addEventListener('keypress', |
| 755 this.handlePasswordKeyPress_.bind(this)); | 756 this.handlePasswordKeyPress_.bind(this)); |
| 756 this.passwordElement.addEventListener('input', | 757 this.passwordElement.addEventListener('input', |
| 757 this.handleInputChanged_.bind(this)); | 758 this.handleInputChanged_.bind(this)); |
| 759 this.passwordElement.addEventListener('mouseup', |
| 760 this.handleInputMouseUp_.bind(this)); |
| 758 | 761 |
| 759 if (this.submitButton) { | 762 if (this.submitButton) { |
| 760 this.submitButton.addEventListener('click', | 763 this.submitButton.addEventListener('click', |
| 761 this.handleSubmitButtonClick_.bind(this)); | 764 this.handleSubmitButtonClick_.bind(this)); |
| 762 } | 765 } |
| 763 | 766 |
| 764 this.imageElement.addEventListener('load', | 767 this.imageElement.addEventListener('load', |
| 765 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); | 768 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| 766 | 769 |
| 767 var initialAuthType = this.user.initialAuthType || | 770 var initialAuthType = this.user.initialAuthType || |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 for (var i = 0; i < elements.length; ++i) | 1163 for (var i = 0; i < elements.length; ++i) |
| 1161 this.updatePinClass_(elements[i], visible); | 1164 this.updatePinClass_(elements[i], visible); |
| 1162 this.updatePinClass_(this, visible); | 1165 this.updatePinClass_(this, visible); |
| 1163 | 1166 |
| 1164 // Set the focus to the input element after showing/hiding pin keyboard. | 1167 // Set the focus to the input element after showing/hiding pin keyboard. |
| 1165 this.mainInput.focus(); | 1168 this.mainInput.focus(); |
| 1166 | 1169 |
| 1167 // Change the password placeholder based on pin keyboard visibility. | 1170 // Change the password placeholder based on pin keyboard visibility. |
| 1168 this.passwordElement.placeholder = loadTimeData.getString(visible ? | 1171 this.passwordElement.placeholder = loadTimeData.getString(visible ? |
| 1169 'pinKeyboardPlaceholderPinPassword' : 'passwordHint'); | 1172 'pinKeyboardPlaceholderPinPassword' : 'passwordHint'); |
| 1173 |
| 1174 chrome.send('setForceDisableVirtualKeyboard', [visible]); |
| 1170 }, | 1175 }, |
| 1171 | 1176 |
| 1172 isPinShown: function() { | 1177 isPinShown: function() { |
| 1173 return this.classList.contains('pin-enabled'); | 1178 return this.classList.contains('pin-enabled'); |
| 1174 }, | 1179 }, |
| 1175 | 1180 |
| 1176 setUserPodIconType: function(userTypeClass) { | 1181 setUserPodIconType: function(userTypeClass) { |
| 1177 this.userTypeIconAreaElement.classList.add(userTypeClass); | 1182 this.userTypeIconAreaElement.classList.add(userTypeClass); |
| 1178 this.userTypeIconAreaElement.hidden = false; | 1183 this.userTypeIconAreaElement.hidden = false; |
| 1179 }, | 1184 }, |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 * button color and state and hides the error popup bubble. | 1865 * button color and state and hides the error popup bubble. |
| 1861 */ | 1866 */ |
| 1862 updateInput_: function() { | 1867 updateInput_: function() { |
| 1863 if (this.submitButton) | 1868 if (this.submitButton) |
| 1864 this.submitButton.disabled = this.passwordElement.value.length <= 0; | 1869 this.submitButton.disabled = this.passwordElement.value.length <= 0; |
| 1865 this.showError = false; | 1870 this.showError = false; |
| 1866 $('bubble').hide(); | 1871 $('bubble').hide(); |
| 1867 }, | 1872 }, |
| 1868 | 1873 |
| 1869 /** | 1874 /** |
| 1870 * Handles pin change event from the pin keyboard. | |
| 1871 * @param {Event} e Pin change event. | |
| 1872 */ | |
| 1873 handlePinChanged_: function(e) { | |
| 1874 this.passwordElement.value = e.detail.pin; | |
| 1875 this.updateInput_(); | |
| 1876 }, | |
| 1877 | |
| 1878 /** | |
| 1879 * Handles input event on the password element. | 1875 * Handles input event on the password element. |
| 1880 * @param {Event} e Input event. | 1876 * @param {Event} e Input event. |
| 1881 */ | 1877 */ |
| 1882 handleInputChanged_: function(e) { | 1878 handleInputChanged_: function(e) { |
| 1883 if (this.pinKeyboard) | |
| 1884 this.pinKeyboard.value = this.passwordElement.value; | |
| 1885 if (this.submitButton) | |
| 1886 this.submitButton.disabled = this.passwordElement.value.length <= 0; | |
| 1887 this.updateInput_(); | 1879 this.updateInput_(); |
| 1888 }, | 1880 }, |
| 1889 | 1881 |
| 1890 /** | 1882 /** |
| 1883 * Handles mouse up event on the password element. |
| 1884 * @param {Event} e Mouse up event. |
| 1885 */ |
| 1886 handleInputMouseUp_: function(e) { |
| 1887 // If the PIN keyboard is shown and the user clicks on the password |
| 1888 // element, the virtual keyboard should pop up if it is enabled, so we |
| 1889 // must disable the virtual keyboard override. |
| 1890 if (this.isPinShown()) { |
| 1891 chrome.send('setForceDisableVirtualKeyboard', [false]); |
| 1892 } |
| 1893 }, |
| 1894 |
| 1895 /** |
| 1891 * Handles click event on a user pod. | 1896 * Handles click event on a user pod. |
| 1892 * @param {Event} e Click event. | 1897 * @param {Event} e Click event. |
| 1893 */ | 1898 */ |
| 1894 handleClickOnPod_: function(e) { | 1899 handleClickOnPod_: function(e) { |
| 1895 if (this.parentNode.disabled) | 1900 if (this.parentNode.disabled) |
| 1896 return; | 1901 return; |
| 1897 | 1902 |
| 1898 if (!this.isActionBoxMenuActive) { | 1903 if (!this.isActionBoxMenuActive) { |
| 1899 if (this.isAuthTypeOnlineSignIn) { | 1904 if (this.isAuthTypeOnlineSignIn) { |
| 1900 this.showSigninUI(); | 1905 this.showSigninUI(); |
| (...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 if (pod && pod.multiProfilesPolicyApplied) { | 3657 if (pod && pod.multiProfilesPolicyApplied) { |
| 3653 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3658 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3654 } | 3659 } |
| 3655 } | 3660 } |
| 3656 }; | 3661 }; |
| 3657 | 3662 |
| 3658 return { | 3663 return { |
| 3659 PodRow: PodRow | 3664 PodRow: PodRow |
| 3660 }; | 3665 }; |
| 3661 }); | 3666 }); |
| OLD | NEW |