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

Unified Diff: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js

Issue 2108813002: Added strings of i18n and made the pin-keyboard work for rtl lang. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed patch set 1 errors. Created 4 years, 6 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
Index: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
diff --git a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
index dfc111d4c5fcd7c32df8aa1e7a95762d0894bfbb..93671d6b347a44005e2a8f1e8879b98737ed68c6 100644
--- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
+++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
@@ -26,6 +26,13 @@ Polymer({
is: 'pin-keyboard',
properties: {
+ enablepassword: {
+ type: Boolean,
+ notify: true,
+ value: false,
+ observer: 'onInputTypeChange_'
+ },
+
/** The value stored in the keyboard's input element. */
value: {
type: String,
@@ -51,6 +58,12 @@ Polymer({
this.fire('submit', { pin: this.value });
},
+ updateRtlState_: function(password) {
+ var shouldRtl = !Number.isInteger(+password);
jdufault 2016/06/28 21:13:22 Add a comment describing this behavior. shouldRtl
sammiequon 2016/06/28 22:43:38 Done.
+ this.$$('#pin-input').classList.toggle(
+ 'pin-keyboard-input-non-pin', shouldRtl);
+ },
+
/**
* Fires an update event with the current PIN value. The event will only be
* fired if the PIN value has actually changed.
@@ -58,8 +71,10 @@ Polymer({
* @param {string} previous
*/
onPinValueChange_: function(value, previous) {
- if (value != previous)
+ if (value != previous) {
this.fire('pin-change', { pin: value });
+ this.updateRtlState_(value);
+ }
},
/** Called when the user wants to erase the last character of the entered
@@ -84,5 +99,20 @@ Polymer({
event.preventDefault();
return;
}
+ },
+
+ /**
+ * Changes the input type for the pin-keyboard input element, based on the
+ * input specified for the pin-keyboard.
+ * @param {string} value
+ * @param {string} previous
+ */
+ onInputTypeChange_: function(value, previous) {
+ if (value != previous && value != null) {
jdufault 2016/06/28 21:13:22 Why do you need this check? Do we need the value o
sammiequon 2016/06/28 22:43:38 Done.
+ if (value)
+ this.$$('#pin-input').type = 'password';
+ else
+ this.$$('#pin-input').type = 'number';
+ }
}
});

Powered by Google App Engine
This is Rietveld 408576698