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

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 5 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..532fd004da8c98cd02d5d2837fe93860c5e93544 100644
--- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
+++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
@@ -25,7 +25,20 @@
Polymer({
is: 'pin-keyboard',
+ behaviors: [
+ I18nBehavior,
+ ],
+
properties: {
+ /**
+ * Whether or not the keyboard's input element should be numerical
+ * or password.
+ */
+ enablePassword: {
+ type: Boolean,
+ value: false
+ },
+
/** The value stored in the keyboard's input element. */
value: {
type: String,
@@ -84,5 +97,30 @@ Polymer({
event.preventDefault();
return;
}
+ },
+
+ /**
+ * Computes whether the input type for the pin input should be password or
+ * numerical.
jdufault 2016/06/30 18:22:12 All three methods should have an @private annotati
sammiequon 2016/06/30 22:18:41 Done.
+ */
+ computeInputType_: function(enablePassword) {
+ return enablePassword ? 'password' : 'number';
+ },
+
+ /** Computes the value of the pin input placeholder. */
+ computeInputPlaceholder_: function(enablePassword) {
+ return enablePassword ? this.i18n('pinKeyboardPlaceholderPinPassword') :
+ this.i18n('pinKeyboardPlaceholderPin');
+ },
+
+ /** Computes the direction of the pin input. */
+ computeInputClass_: function(password) {
+ // +password will convert a string to a number or to NaN if that's not
+ // possible. Number.isInteger will verify the value is not a NaN and that it
+ // does not contain decimals.
+ //
+ // This heuristic will fail for inputs like '1.0'.
+ var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password);
+ return enableRtl ? 'input-non-pin' : '';
}
});

Powered by Google App Engine
This is Rietveld 408576698