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 daa92b6f23d8385c220ba387abc0b2249136af38..d42451a360e20bf6a7d6fe612c50422d86a263e3 100644 |
| --- a/ui/login/account_picker/user_pod_row.js |
| +++ b/ui/login/account_picker/user_pod_row.js |
| @@ -716,6 +716,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', |
| @@ -753,6 +755,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)); |
| @@ -874,6 +878,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} |
| @@ -1105,14 +1113,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); |
| // Set the focus to the input element after showing/hiding pin keyboard. |
| - if (this.pinKeyboard && visible) |
| - this.pinKeyboard.focus(); |
| + this.mainInput.focus(); |
| }, |
| isPinShown: function() { |
| @@ -1154,8 +1168,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; |
| @@ -1811,6 +1823,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. |
| @@ -2611,19 +2632,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); |
| }, |
| /** |
| @@ -2941,7 +2973,11 @@ cr.define('login', function() { |
| if (layout.columns != this.columns || layout.rows != this.rows) |
| this.placePods_(); |
| - this.scrollFocusedPodIntoView(); |
| + // Wrap this in a set timeout so the function is called after the pod is |
| + // finished transitioning so that we work with the final pod dimensions. |
| + setTimeout(function(param1) { |
|
jdufault
2016/08/29 23:58:38
Please rename parameter
sammiequon
2016/08/30 01:24:56
Done.
|
| + param1.scrollFocusedPodIntoView(); |
| + }, 200, this); |
| }, |
| /** |