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 2b77a47912f8b84197e491f3d0c3c13ee2bbc6f4..741baa9550c74b5dbf3a19db7e384e1f0dc048b8 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; |
| + |
| + // Do not show pin if virtual keyboard is there. |
| + if (visible && Oobe.getInstance().virtualKeyboardShown) |
| + 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); |
|
jdufault
2016/08/25 18:35:09
Should this function even be getting called when t
sammiequon
2016/08/25 23:29:40
Done.
|
| + 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; |
| @@ -1790,6 +1802,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. |
| @@ -2590,19 +2611,30 @@ cr.define('login', function() { |
| }, |
| /** |
| - * Toggles pod PIN keyboard visiblity. |
| + * 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); |
| + }, |
| + |
| + /** |
| + * Remove the pin keyboard from the pod with the given |username|. |
| * @param {!user} username |
| * @param {boolean} visible |
| */ |
| - setPinVisibility: function(username, visible) { |
| + removePinKeyboard: function(username) { |
| var pod = this.getPodWithUsername_(username); |
| if (!pod) { |
| - console.warn('Attempt to change pin visibility to ' + visible + |
| - ' for missing pod'); |
| + console.warn('Attempt to remove pin keyboard of missing pod.'); |
| return; |
| } |
| - |
| - pod.setPinVisibility(visible); |
| + // Remove the child, so that the virtual keyboard cannot bring it up |
| + // again after three tries. |
| + if (pod.pinContainer) |
| + pod.removeChild(pod.pinContainer); |
| + pod.setPinVisibility(false); |
| }, |
| /** |
| @@ -3144,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) { |