Chromium Code Reviews| Index: ui/login/account_picker/user_pod_row.js |
| diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js |
| index 8ba4ac4b55f98a04e557da1acaa83c644849ac4f..53b5b516bb3791085ab8b6a5fb0321591322dab4 100644 |
| --- a/ui/login/account_picker/user_pod_row.js |
| +++ b/ui/login/account_picker/user_pod_row.js |
| @@ -718,6 +718,8 @@ cr.define('login', function() { |
| if (this.pinKeyboard) { |
| this.pinKeyboard.addEventListener('submit', |
| this.handlePinSubmitted_.bind(this)); |
| + this.pinKeyboard.addEventListener('pin-change', |
| + this.handlePinChanged_.bind(this)); |
| } |
| this.actionBoxAreaElement.addEventListener('mousedown', |
| @@ -755,6 +757,8 @@ cr.define('login', function() { |
| this.parentNode.handleKeyDown.bind(this.parentNode)); |
| this.passwordElement.addEventListener('keypress', |
| this.handlePasswordKeyPress_.bind(this)); |
| + this.passwordElement.addEventListener('input', |
| + this.handleInputChanged_.bind(this)); |
| this.imageElement.addEventListener('load', |
| this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
| @@ -876,6 +880,10 @@ cr.define('login', function() { |
| return this.querySelector('.password-label'); |
| }, |
| + get pinContainer() { |
| + return this.querySelector('.pin-container'); |
| + }, |
| + |
| /** |
| * Gets the pin-keyboard of the pod. |
| * @type {!HTMLElement} |
| @@ -1103,14 +1111,20 @@ cr.define('login', function() { |
| }, |
| setPinVisibility: function(visible) { |
| + if (this.isPinShown() == visible) |
| + return; |
| + |
| + // If the header is hidden that means the virtual keyboard is displayed. |
| + if (visible && Oobe.getInstance().headerHidden) |
|
jdufault
2016/08/24 01:35:11
Add a helper method hasVirtualKeyboard on the Oobe
sammiequon
2016/08/25 18:12:33
Done.
|
| + return; |
| + |
| var elements = this.getElementsByClassName('pin-tag'); |
| for (var i = 0; i < elements.length; ++i) |
| - this.updatePinClass_(elements[i], visible); |
| - this.updatePinClass_(this, visible); |
| + this.updatePinClass_(elements[i], this.pinKeyboard? visible : false); |
| + this.updatePinClass_(this, this.pinKeyboard? visible : false); |
| // Set the focus to the input element after showing/hiding pin keyboard. |
| - if (this.pinKeyboard && visible) |
| - this.pinKeyboard.focus(); |
| + this.mainInput.focus(); |
| }, |
| isPinShown: function() { |
| @@ -1152,8 +1166,6 @@ cr.define('login', function() { |
| */ |
| get mainInput() { |
| if (this.isAuthTypePassword) { |
| - if (this.isPinShown() && this.pinKeyboard.inputElement) |
| - return this.pinKeyboard.inputElement; |
| return this.passwordElement; |
| } else if (this.isAuthTypeOnlineSignIn) { |
| return this; |
| @@ -1789,6 +1801,15 @@ cr.define('login', function() { |
| this.parentNode.setActivatedPod(this); |
| }, |
| + handlePinChanged_: function(e) { |
| + this.passwordElement.value = e.detail.pin; |
| + }, |
| + |
| + handleInputChanged_: function(e) { |
| + if (this.pinKeyboard) |
| + this.pinKeyboard.value = this.passwordElement.value; |
| + }, |
| + |
| /** |
| * Handles click event on a user pod. |
| * @param {Event} e Click event. |
| @@ -2589,6 +2610,15 @@ cr.define('login', function() { |
| }, |
| /** |
| + * Function that hides the pin keyboard. Meant to be called when the virtual |
| + * keyboard is enabled and being toggled. |
| + * @param {boolean} hidden |
| + */ |
| + setPinHidden: function(hidden) { |
| + this.setFocusedPodPinVisibility(!hidden); |
| + }, |
| + |
| + /** |
| * Toggles pod PIN keyboard visiblity. |
| * @param {!user} username |
| * @param {boolean} visible |
| @@ -2600,8 +2630,11 @@ cr.define('login', function() { |
| ' for missing pod'); |
| return; |
| } |
| - |
| - pod.setPinVisibility(visible); |
| + // Remove the child, so that the virtual keyboard cannot bring it up |
| + // again after three tries. |
|
jdufault
2016/08/24 01:35:11
setPinVisiblity is named and read such that the PI
sammiequon
2016/08/25 18:12:34
Done.
|
| + if (pod.pinContainer) |
| + pod.removeChild(pod.pinContainer); |
| + pod.setPinVisibility(false); |
|
jdufault
2016/08/24 01:35:11
What if |visible| is true?
If this function is on
sammiequon
2016/08/25 18:12:34
Done.
|
| }, |
| /** |
| @@ -3143,7 +3176,8 @@ cr.define('login', function() { |
| var hadFocus = !!this.focusedPod_; |
| this.focusedPod_ = podToFocus; |
| if (podToFocus) { |
| - this.setFocusedPodPinVisibility(true); |
| + if (!hadFocus) |
| + this.setFocusedPodPinVisibility(true); |
| podToFocus.classList.remove('faded'); |
| podToFocus.classList.add('focused'); |
| if (!podToFocus.multiProfilesPolicyApplied) { |