Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: ui/login/account_picker/user_pod_row.js

Issue 2260653002: Pin keyboard works with virtual keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Nit. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/login/account_picker/user_pod_row.css ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dbf03e91657250ff9b917a4631318018737ffcf5 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(podrow) {
+ podrow.scrollFocusedPodIntoView();
+ }, 200, this);
},
/**
« no previous file with comments | « ui/login/account_picker/user_pod_row.css ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698