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 dfb2b3ad0cbaf2df2e64bc0bd1ddeec38b5d9d37..09a5c55272f7792b4cd958390fd53bdc944c7d79 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)); |
| @@ -1103,14 +1107,16 @@ cr.define('login', function() { |
| }, |
| setPinVisibility: function(visible) { |
| + if (this.isPinShown() == visible) |
| + 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() { |
| @@ -1770,6 +1776,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.setNewValue(this.passwordElement.value); |
| + }, |
| + |
| /** |
| * Handles click event on a user pod. |
| * @param {Event} e Click event. |
| @@ -2393,6 +2408,10 @@ cr.define('login', function() { |
| // True if inside focusPod(). |
| insideFocusPod_: false, |
| + // Prevents the pin from being shown because the virtual keyboard is enabled |
| + // and being displayed. |
| + dontShowPinOverride_: false, |
|
jdufault
2016/08/19 01:06:47
forceHidePin?
sammiequon
2016/08/23 17:28:11
Removed.
|
| + |
| // Focused pod. |
| focusedPod_: undefined, |
| @@ -2548,8 +2567,13 @@ cr.define('login', function() { |
| }, |
| setFocusedPodPinVisibility: function(visible) { |
| - if (this.focusedPod_ && this.focusedPod_.user.showPin) |
| + if (this.focusedPod_ && this.focusedPod_.user.showPin) { |
| + if (this.dontShowPinOverride_) { |
| + this.dontShowPinOverride_ = false; |
| + return; |
| + } |
| this.focusedPod_.setPinVisibility(visible); |
| + } |
| }, |
| /** |
| @@ -2570,6 +2594,23 @@ 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) { |
| + if (hidden) { |
| + // This function gets called before the pods are loaded so we set a flag |
| + // tell the next show pin keyboard call to not show the pin keyboard. |
| + if (this.pods.length <= 0) |
| + this.dontShowPinOverride_ = true; |
|
jdufault
2016/08/19 17:28:18
We have code that fires when the PIN keyboard is f
sammiequon
2016/08/23 17:28:12
Done.
|
| + else |
| + this.setFocusedPodPinVisibility(false); |
| + } else |
| + this.setFocusedPodPinVisibility(true); |
|
jdufault
2016/08/19 17:28:18
need {}
sammiequon
2016/08/23 17:28:12
Removed.
|
| + }, |
| + |
| + /** |
| * Toggles pod PIN keyboard visiblity. |
| * @param {!user} username |
| * @param {boolean} visible |
| @@ -3124,7 +3165,10 @@ cr.define('login', function() { |
| var hadFocus = !!this.focusedPod_; |
| this.focusedPod_ = podToFocus; |
| if (podToFocus) { |
| - this.setFocusedPodPinVisibility(true); |
| + if (!hadFocus) { |
| + if (!this.dontShowPinOverride_) |
|
jdufault
2016/08/19 17:28:18
combine if statements
sammiequon
2016/08/23 17:28:12
Removed.
|
| + this.setFocusedPodPinVisibility(true); |
| + } |
| podToFocus.classList.remove('faded'); |
| podToFocus.classList.add('focused'); |
| if (!podToFocus.multiProfilesPolicyApplied) { |