| 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 /** | 750 /** |
| 751 * Initializes the pod after its properties set and added to a pod row. | 751 * Initializes the pod after its properties set and added to a pod row. |
| 752 */ | 752 */ |
| 753 initialize: function() { | 753 initialize: function() { |
| 754 this.passwordElement.addEventListener('keydown', | 754 this.passwordElement.addEventListener('keydown', |
| 755 this.parentNode.handleKeyDown.bind(this.parentNode)); | 755 this.parentNode.handleKeyDown.bind(this.parentNode)); |
| 756 this.passwordElement.addEventListener('keypress', | 756 this.passwordElement.addEventListener('keypress', |
| 757 this.handlePasswordKeyPress_.bind(this)); | 757 this.handlePasswordKeyPress_.bind(this)); |
| 758 this.passwordElement.addEventListener('input', | 758 this.passwordElement.addEventListener('input', |
| 759 this.handleInputChanged_.bind(this)); | 759 this.handleInputChanged_.bind(this)); |
| 760 this.submitButton.addEventListener('click', | 760 if (this.submitButton) { |
| 761 this.handleSubmitButtonClick_.bind(this)); | 761 this.submitButton.addEventListener('click', |
| 762 this.handleSubmitButtonClick_.bind(this)); |
| 763 } |
| 762 | 764 |
| 763 this.imageElement.addEventListener('load', | 765 this.imageElement.addEventListener('load', |
| 764 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); | 766 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| 765 | 767 |
| 766 var initialAuthType = this.user.initialAuthType || | 768 var initialAuthType = this.user.initialAuthType || |
| 767 AUTH_TYPE.OFFLINE_PASSWORD; | 769 AUTH_TYPE.OFFLINE_PASSWORD; |
| 768 this.setAuthType(initialAuthType, null); | 770 this.setAuthType(initialAuthType, null); |
| 769 | 771 |
| 770 this.userClickAuthAllowed_ = false; | 772 this.userClickAuthAllowed_ = false; |
| 771 | 773 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 } else if (this.user_.isApp) { | 1127 } else if (this.user_.isApp) { |
| 1126 this.setUserPodIconType('app'); | 1128 this.setUserPodIconType('app'); |
| 1127 } | 1129 } |
| 1128 }, | 1130 }, |
| 1129 | 1131 |
| 1130 isPinReady: function() { | 1132 isPinReady: function() { |
| 1131 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0; | 1133 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0; |
| 1132 }, | 1134 }, |
| 1133 | 1135 |
| 1134 set showError(visible) { | 1136 set showError(visible) { |
| 1135 this.submitButton.classList.toggle('error-shown', visible); | 1137 if (this.submitButton) |
| 1138 this.submitButton.classList.toggle('error-shown', visible); |
| 1136 }, | 1139 }, |
| 1137 | 1140 |
| 1138 toggleTransitions: function(enable) { | 1141 toggleTransitions: function(enable) { |
| 1139 this.classList.toggle('flying-pin-pod', enable); | 1142 this.classList.toggle('flying-pin-pod', enable); |
| 1140 }, | 1143 }, |
| 1141 | 1144 |
| 1142 updatePinClass_: function(element, enable) { | 1145 updatePinClass_: function(element, enable) { |
| 1143 element.classList.toggle('pin-enabled', enable); | 1146 element.classList.toggle('pin-enabled', enable); |
| 1144 element.classList.toggle('pin-disabled', !enable); | 1147 element.classList.toggle('pin-disabled', !enable); |
| 1145 }, | 1148 }, |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 this.parentNode.setActivatedPod(this); | 1858 this.parentNode.setActivatedPod(this); |
| 1856 }, | 1859 }, |
| 1857 | 1860 |
| 1858 handlePinChanged_: function(e) { | 1861 handlePinChanged_: function(e) { |
| 1859 this.passwordElement.value = e.detail.pin; | 1862 this.passwordElement.value = e.detail.pin; |
| 1860 }, | 1863 }, |
| 1861 | 1864 |
| 1862 handleInputChanged_: function(e) { | 1865 handleInputChanged_: function(e) { |
| 1863 if (this.pinKeyboard) | 1866 if (this.pinKeyboard) |
| 1864 this.pinKeyboard.value = this.passwordElement.value; | 1867 this.pinKeyboard.value = this.passwordElement.value; |
| 1865 this.submitButton.disabled = this.passwordElement.value.length <= 0; | 1868 if (this.submitButton) |
| 1869 this.submitButton.disabled = this.passwordElement.value.length <= 0; |
| 1866 this.showError = false; | 1870 this.showError = false; |
| 1867 }, | 1871 }, |
| 1868 | 1872 |
| 1869 /** | 1873 /** |
| 1870 * Handles click event on a user pod. | 1874 * Handles click event on a user pod. |
| 1871 * @param {Event} e Click event. | 1875 * @param {Event} e Click event. |
| 1872 */ | 1876 */ |
| 1873 handleClickOnPod_: function(e) { | 1877 handleClickOnPod_: function(e) { |
| 1874 if (this.parentNode.disabled) | 1878 if (this.parentNode.disabled) |
| 1875 return; | 1879 return; |
| (...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3632 if (pod && pod.multiProfilesPolicyApplied) { | 3636 if (pod && pod.multiProfilesPolicyApplied) { |
| 3633 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3637 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3634 } | 3638 } |
| 3635 } | 3639 } |
| 3636 }; | 3640 }; |
| 3637 | 3641 |
| 3638 return { | 3642 return { |
| 3639 PodRow: PodRow | 3643 PodRow: PodRow |
| 3640 }; | 3644 }; |
| 3641 }); | 3645 }); |
| OLD | NEW |