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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 | 705 |
| 706 /** @override */ | 706 /** @override */ |
| 707 decorate: function() { | 707 decorate: function() { |
| 708 this.tabIndex = UserPodTabOrder.POD_INPUT; | 708 this.tabIndex = UserPodTabOrder.POD_INPUT; |
| 709 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.POD_INPUT; | 709 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.POD_INPUT; |
| 710 | 710 |
| 711 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this)); | 711 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this)); |
| 712 this.addEventListener('click', this.handleClickOnPod_.bind(this)); | 712 this.addEventListener('click', this.handleClickOnPod_.bind(this)); |
| 713 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this)); | 713 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this)); |
| 714 | 714 |
| 715 if(this.pinKeyboard) { | |
|
jdufault
2016/07/18 18:17:26
nit: space after if before (
sammiequon
2016/07/18 18:49:36
Done.
| |
| 716 this.pinKeyboard.addEventListener('submit', | |
| 717 this.handlePinSubmitted_.bind(this)); | |
| 718 } | |
| 719 | |
| 715 this.actionBoxAreaElement.addEventListener('mousedown', | 720 this.actionBoxAreaElement.addEventListener('mousedown', |
| 716 stopEventPropagation); | 721 stopEventPropagation); |
| 717 this.actionBoxAreaElement.addEventListener('click', | 722 this.actionBoxAreaElement.addEventListener('click', |
| 718 this.handleActionAreaButtonClick_.bind(this)); | 723 this.handleActionAreaButtonClick_.bind(this)); |
| 719 this.actionBoxAreaElement.addEventListener('keydown', | 724 this.actionBoxAreaElement.addEventListener('keydown', |
| 720 this.handleActionAreaButtonKeyDown_.bind(this)); | 725 this.handleActionAreaButtonKeyDown_.bind(this)); |
| 721 | 726 |
| 722 this.actionBoxMenuTitleElement.addEventListener('keydown', | 727 this.actionBoxMenuTitleElement.addEventListener('keydown', |
| 723 this.handleMenuTitleElementKeyDown_.bind(this)); | 728 this.handleMenuTitleElementKeyDown_.bind(this)); |
| 724 this.actionBoxMenuTitleElement.addEventListener('blur', | 729 this.actionBoxMenuTitleElement.addEventListener('blur', |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1784 * Handles mouse down event. It sets whether the user click auth will be | 1789 * Handles mouse down event. It sets whether the user click auth will be |
| 1785 * allowed on the next mouse click event. The auth is allowed iff the pod | 1790 * allowed on the next mouse click event. The auth is allowed iff the pod |
| 1786 * was focused on the mouse down event starting the click. | 1791 * was focused on the mouse down event starting the click. |
| 1787 * @param {Event} e The mouse down event. | 1792 * @param {Event} e The mouse down event. |
| 1788 */ | 1793 */ |
| 1789 handlePodMouseDown_: function(e) { | 1794 handlePodMouseDown_: function(e) { |
| 1790 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); | 1795 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); |
| 1791 }, | 1796 }, |
| 1792 | 1797 |
| 1793 /** | 1798 /** |
| 1799 * Handles click event on submit button on the pin keyboard. | |
| 1800 * @param {Event} e Click event. | |
| 1801 */ | |
| 1802 handlePinSubmitted_: function(e) { | |
| 1803 if (this.parentNode.isFocused(this)) | |
| 1804 this.parentNode.setActivatedPod(this); | |
| 1805 }, | |
| 1806 | |
| 1807 /** | |
| 1794 * Handles click event on a user pod. | 1808 * Handles click event on a user pod. |
| 1795 * @param {Event} e Click event. | 1809 * @param {Event} e Click event. |
| 1796 */ | 1810 */ |
| 1797 handleClickOnPod_: function(e) { | 1811 handleClickOnPod_: function(e) { |
| 1798 if (this.parentNode.disabled) | 1812 if (this.parentNode.disabled) |
| 1799 return; | 1813 return; |
| 1800 | 1814 |
| 1801 if (!this.isActionBoxMenuActive) { | 1815 if (!this.isActionBoxMenuActive) { |
| 1802 if (this.isAuthTypeOnlineSignIn) { | 1816 if (this.isAuthTypeOnlineSignIn) { |
| 1803 this.showSigninUI(); | 1817 this.showSigninUI(); |
| 1804 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { | 1818 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { |
| 1805 // Note that this.userClickAuthAllowed_ is set in mouse down event | 1819 // Note that this.userClickAuthAllowed_ is set in mouse down event |
| 1806 // handler. | 1820 // handler. |
| 1807 this.parentNode.setActivatedPod(this); | 1821 this.parentNode.setActivatedPod(this); |
| 1808 } else if (this.pinKeyboard.submitButton && | |
| 1809 e.target == this.pinKeyboard.submitButton) { | |
| 1810 // Sets the pod as activated if the submit button is clicked so that | |
| 1811 // it simulates what the enter button does for the password/pin. | |
| 1812 this.parentNode.setActivatedPod(this); | |
| 1813 } | 1822 } |
| 1814 | 1823 |
| 1815 if (this.multiProfilesPolicyApplied) | 1824 if (this.multiProfilesPolicyApplied) |
| 1816 this.userTypeBubbleElement.classList.add('bubble-shown'); | 1825 this.userTypeBubbleElement.classList.add('bubble-shown'); |
| 1817 | 1826 |
| 1818 // Prevent default so that we don't trigger 'focus' event and | 1827 // Prevent default so that we don't trigger 'focus' event and |
| 1819 // stop propagation so that the 'click' event does not bubble | 1828 // stop propagation so that the 'click' event does not bubble |
| 1820 // up and accidentally closes the bubble tooltip. | 1829 // up and accidentally closes the bubble tooltip. |
| 1821 stopEventPropagation(e); | 1830 stopEventPropagation(e); |
| 1822 } | 1831 } |
| (...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3505 if (pod && pod.multiProfilesPolicyApplied) { | 3514 if (pod && pod.multiProfilesPolicyApplied) { |
| 3506 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3515 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3507 } | 3516 } |
| 3508 } | 3517 } |
| 3509 }; | 3518 }; |
| 3510 | 3519 |
| 3511 return { | 3520 return { |
| 3512 PodRow: PodRow | 3521 PodRow: PodRow |
| 3513 }; | 3522 }; |
| 3514 }); | 3523 }); |
| OLD | NEW |