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) | |
| 716 this.pinKeyboard.addEventListener('submit', | |
|
jdufault
2016/07/15 20:05:15
Add {} for multiline if statements.
sammiequon
2016/07/18 18:49:36
Done.
| |
| 717 this.handlePinSubmitted_.bind(this)); | |
| 718 | |
| 715 this.actionBoxAreaElement.addEventListener('mousedown', | 719 this.actionBoxAreaElement.addEventListener('mousedown', |
| 716 stopEventPropagation); | 720 stopEventPropagation); |
| 717 this.actionBoxAreaElement.addEventListener('click', | 721 this.actionBoxAreaElement.addEventListener('click', |
| 718 this.handleActionAreaButtonClick_.bind(this)); | 722 this.handleActionAreaButtonClick_.bind(this)); |
| 719 this.actionBoxAreaElement.addEventListener('keydown', | 723 this.actionBoxAreaElement.addEventListener('keydown', |
| 720 this.handleActionAreaButtonKeyDown_.bind(this)); | 724 this.handleActionAreaButtonKeyDown_.bind(this)); |
| 721 | 725 |
| 722 this.actionBoxMenuTitleElement.addEventListener('keydown', | 726 this.actionBoxMenuTitleElement.addEventListener('keydown', |
| 723 this.handleMenuTitleElementKeyDown_.bind(this)); | 727 this.handleMenuTitleElementKeyDown_.bind(this)); |
| 724 this.actionBoxMenuTitleElement.addEventListener('blur', | 728 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 | 1788 * 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 | 1789 * 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. | 1790 * was focused on the mouse down event starting the click. |
| 1787 * @param {Event} e The mouse down event. | 1791 * @param {Event} e The mouse down event. |
| 1788 */ | 1792 */ |
| 1789 handlePodMouseDown_: function(e) { | 1793 handlePodMouseDown_: function(e) { |
| 1790 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); | 1794 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); |
| 1791 }, | 1795 }, |
| 1792 | 1796 |
| 1793 /** | 1797 /** |
| 1798 * Handles click event on submit button on the pin keyboard. | |
| 1799 * @param {Event} e Click event. | |
| 1800 */ | |
| 1801 handlePinSubmitted_: function(e) { | |
| 1802 if (this.parentNode.isFocused(this)) | |
| 1803 this.parentNode.setActivatedPod(this); | |
| 1804 }, | |
| 1805 | |
| 1806 /** | |
| 1794 * Handles click event on a user pod. | 1807 * Handles click event on a user pod. |
| 1795 * @param {Event} e Click event. | 1808 * @param {Event} e Click event. |
| 1796 */ | 1809 */ |
| 1797 handleClickOnPod_: function(e) { | 1810 handleClickOnPod_: function(e) { |
| 1798 if (this.parentNode.disabled) | 1811 if (this.parentNode.disabled) |
| 1799 return; | 1812 return; |
| 1800 | 1813 |
| 1801 if (!this.isActionBoxMenuActive) { | 1814 if (!this.isActionBoxMenuActive) { |
| 1802 if (this.isAuthTypeOnlineSignIn) { | 1815 if (this.isAuthTypeOnlineSignIn) { |
| 1803 this.showSigninUI(); | 1816 this.showSigninUI(); |
| 1804 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { | 1817 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { |
| 1805 // Note that this.userClickAuthAllowed_ is set in mouse down event | 1818 // Note that this.userClickAuthAllowed_ is set in mouse down event |
| 1806 // handler. | 1819 // handler. |
| 1807 this.parentNode.setActivatedPod(this); | 1820 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 } | 1821 } |
| 1814 | 1822 |
| 1815 if (this.multiProfilesPolicyApplied) | 1823 if (this.multiProfilesPolicyApplied) |
| 1816 this.userTypeBubbleElement.classList.add('bubble-shown'); | 1824 this.userTypeBubbleElement.classList.add('bubble-shown'); |
| 1817 | 1825 |
| 1818 // Prevent default so that we don't trigger 'focus' event and | 1826 // Prevent default so that we don't trigger 'focus' event and |
| 1819 // stop propagation so that the 'click' event does not bubble | 1827 // stop propagation so that the 'click' event does not bubble |
| 1820 // up and accidentally closes the bubble tooltip. | 1828 // up and accidentally closes the bubble tooltip. |
| 1821 stopEventPropagation(e); | 1829 stopEventPropagation(e); |
| 1822 } | 1830 } |
| (...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3505 if (pod && pod.multiProfilesPolicyApplied) { | 3513 if (pod && pod.multiProfilesPolicyApplied) { |
| 3506 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3514 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3507 } | 3515 } |
| 3508 } | 3516 } |
| 3509 }; | 3517 }; |
| 3510 | 3518 |
| 3511 return { | 3519 return { |
| 3512 PodRow: PodRow | 3520 PodRow: PodRow |
| 3513 }; | 3521 }; |
| 3514 }); | 3522 }); |
| OLD | NEW |