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 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.addEventListener('submit', | |
| 718 this.handlePinSubmitted_.bind(this)); | |
| 719 this.pinKeyboard.addEventListener('pin-change', | 717 this.pinKeyboard.addEventListener('pin-change', |
| 720 this.handlePinChanged_.bind(this)); | 718 this.handlePinChanged_.bind(this)); |
| 721 } | 719 } |
| 722 | 720 |
| 723 this.actionBoxAreaElement.addEventListener('mousedown', | 721 this.actionBoxAreaElement.addEventListener('mousedown', |
| 724 stopEventPropagation); | 722 stopEventPropagation); |
| 725 this.actionBoxAreaElement.addEventListener('click', | 723 this.actionBoxAreaElement.addEventListener('click', |
| 726 this.handleActionAreaButtonClick_.bind(this)); | 724 this.handleActionAreaButtonClick_.bind(this)); |
| 727 this.actionBoxAreaElement.addEventListener('keydown', | 725 this.actionBoxAreaElement.addEventListener('keydown', |
| 728 this.handleActionAreaButtonKeyDown_.bind(this)); | 726 this.handleActionAreaButtonKeyDown_.bind(this)); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 750 /** | 748 /** |
| 751 * Initializes the pod after its properties set and added to a pod row. | 749 * Initializes the pod after its properties set and added to a pod row. |
| 752 */ | 750 */ |
| 753 initialize: function() { | 751 initialize: function() { |
| 754 this.passwordElement.addEventListener('keydown', | 752 this.passwordElement.addEventListener('keydown', |
| 755 this.parentNode.handleKeyDown.bind(this.parentNode)); | 753 this.parentNode.handleKeyDown.bind(this.parentNode)); |
| 756 this.passwordElement.addEventListener('keypress', | 754 this.passwordElement.addEventListener('keypress', |
| 757 this.handlePasswordKeyPress_.bind(this)); | 755 this.handlePasswordKeyPress_.bind(this)); |
| 758 this.passwordElement.addEventListener('input', | 756 this.passwordElement.addEventListener('input', |
| 759 this.handleInputChanged_.bind(this)); | 757 this.handleInputChanged_.bind(this)); |
| 758 | |
| 760 this.submitButton.addEventListener('click', | 759 this.submitButton.addEventListener('click', |
| 761 this.handleSubmitButtonClick_.bind(this)); | 760 this.handleSubmitButtonClick_.bind(this)); |
| 762 | 761 |
| 763 this.imageElement.addEventListener('load', | 762 this.imageElement.addEventListener('load', |
| 764 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); | 763 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| 765 | 764 |
| 766 var initialAuthType = this.user.initialAuthType || | 765 var initialAuthType = this.user.initialAuthType || |
| 767 AUTH_TYPE.OFFLINE_PASSWORD; | 766 AUTH_TYPE.OFFLINE_PASSWORD; |
| 768 this.setAuthType(initialAuthType, null); | 767 this.setAuthType(initialAuthType, null); |
| 769 | 768 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1152 if (visible && Oobe.getInstance().virtualKeyboardShown) | 1151 if (visible && Oobe.getInstance().virtualKeyboardShown) |
| 1153 return; | 1152 return; |
| 1154 | 1153 |
| 1155 var elements = this.getElementsByClassName('pin-tag'); | 1154 var elements = this.getElementsByClassName('pin-tag'); |
| 1156 for (var i = 0; i < elements.length; ++i) | 1155 for (var i = 0; i < elements.length; ++i) |
| 1157 this.updatePinClass_(elements[i], visible); | 1156 this.updatePinClass_(elements[i], visible); |
| 1158 this.updatePinClass_(this, visible); | 1157 this.updatePinClass_(this, visible); |
| 1159 | 1158 |
| 1160 // Set the focus to the input element after showing/hiding pin keyboard. | 1159 // Set the focus to the input element after showing/hiding pin keyboard. |
| 1161 this.mainInput.focus(); | 1160 this.mainInput.focus(); |
| 1161 | |
| 1162 // Change the password placeholder based on pin keyboard visibility. | |
| 1163 this.passwordElement.placeholder = loadTimeData.getString(visible ? | |
| 1164 'pinKeyboardPlaceholderPinPassword' : 'passwordHint'); | |
| 1162 }, | 1165 }, |
| 1163 | 1166 |
| 1164 isPinShown: function() { | 1167 isPinShown: function() { |
| 1165 return this.classList.contains('pin-enabled'); | 1168 return this.classList.contains('pin-enabled'); |
| 1166 }, | 1169 }, |
| 1167 | 1170 |
| 1168 setUserPodIconType: function(userTypeClass) { | 1171 setUserPodIconType: function(userTypeClass) { |
| 1169 this.userTypeIconAreaElement.classList.add(userTypeClass); | 1172 this.userTypeIconAreaElement.classList.add(userTypeClass); |
| 1170 this.userTypeIconAreaElement.hidden = false; | 1173 this.userTypeIconAreaElement.hidden = false; |
| 1171 }, | 1174 }, |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1840 * Handles mouse down event. It sets whether the user click auth will be | 1843 * Handles mouse down event. It sets whether the user click auth will be |
| 1841 * allowed on the next mouse click event. The auth is allowed iff the pod | 1844 * allowed on the next mouse click event. The auth is allowed iff the pod |
| 1842 * was focused on the mouse down event starting the click. | 1845 * was focused on the mouse down event starting the click. |
| 1843 * @param {Event} e The mouse down event. | 1846 * @param {Event} e The mouse down event. |
| 1844 */ | 1847 */ |
| 1845 handlePodMouseDown_: function(e) { | 1848 handlePodMouseDown_: function(e) { |
| 1846 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); | 1849 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); |
| 1847 }, | 1850 }, |
| 1848 | 1851 |
| 1849 /** | 1852 /** |
| 1850 * Handles click event on submit button on the pin keyboard. | 1853 * Handles updating the submit button disable state and color. |
| 1851 * @param {Event} e Click event. | |
| 1852 */ | 1854 */ |
| 1853 handlePinSubmitted_: function(e) { | 1855 updateSubmitButton_: function() { |
|
jdufault
2016/09/02 22:58:53
What about naming this updateInput_ or something l
sammiequon
2016/09/03 00:53:49
Done.
| |
| 1854 if (this.parentNode.isFocused(this)) | 1856 this.submitButton.disabled = this.passwordElement.value.length <= 0; |
| 1855 this.parentNode.setActivatedPod(this); | 1857 this.showError = false; |
| 1858 $('bubble').hide(); | |
| 1856 }, | 1859 }, |
| 1857 | 1860 |
| 1861 /** | |
| 1862 * Handles pin change event from the pin keyboard. | |
| 1863 * @param {Event} e Pin change event. | |
| 1864 */ | |
| 1858 handlePinChanged_: function(e) { | 1865 handlePinChanged_: function(e) { |
| 1859 this.passwordElement.value = e.detail.pin; | 1866 this.passwordElement.value = e.detail.pin; |
| 1867 this.updateSubmitButton_(); | |
| 1860 }, | 1868 }, |
| 1861 | 1869 |
| 1870 /** | |
| 1871 * Handles input event on the password element. | |
| 1872 * @param {Event} e Input event. | |
| 1873 */ | |
| 1862 handleInputChanged_: function(e) { | 1874 handleInputChanged_: function(e) { |
| 1863 if (this.pinKeyboard) | 1875 if (this.pinKeyboard) |
| 1864 this.pinKeyboard.value = this.passwordElement.value; | 1876 this.pinKeyboard.value = this.passwordElement.value; |
| 1865 this.submitButton.disabled = this.passwordElement.value.length <= 0; | 1877 this.updateSubmitButton_(); |
| 1866 this.showError = false; | |
| 1867 }, | 1878 }, |
| 1868 | 1879 |
| 1869 /** | 1880 /** |
| 1870 * Handles click event on a user pod. | 1881 * Handles click event on a user pod. |
| 1871 * @param {Event} e Click event. | 1882 * @param {Event} e Click event. |
| 1872 */ | 1883 */ |
| 1873 handleClickOnPod_: function(e) { | 1884 handleClickOnPod_: function(e) { |
| 1874 if (this.parentNode.disabled) | 1885 if (this.parentNode.disabled) |
| 1875 return; | 1886 return; |
| 1876 | 1887 |
| (...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3632 if (pod && pod.multiProfilesPolicyApplied) { | 3643 if (pod && pod.multiProfilesPolicyApplied) { |
| 3633 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3644 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3634 } | 3645 } |
| 3635 } | 3646 } |
| 3636 }; | 3647 }; |
| 3637 | 3648 |
| 3638 return { | 3649 return { |
| 3639 PodRow: PodRow | 3650 PodRow: PodRow |
| 3640 }; | 3651 }; |
| 3641 }); | 3652 }); |
| OLD | NEW |