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

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

Issue 1933913002: Add a very basic PIN UI implementation that is shared between lock and settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix tests by removing a previously unused import that started getting used b/c of resource loader c… Created 4 years, 7 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
new file mode 100644
index 0000000000000000000000000000000000000000..a5cbe3b7c5c1c5616a7a1ababb4cc36f279640c4
--- /dev/null
+++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
@@ -0,0 +1,36 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'pin-keyboard',
+
+ // Called when a keypad number has been tapped.
+ onNumberTap_: function(event, detail) {
+ var target = event.target;
+ var value = target.getAttribute('value');
+
+ var input = this.$$('#pin-input');
+ input.value += value;
+ },
+
+ // Called when the user wants to submit the PIN.
+ onPinSubmit_: function() {
+ var pin = this.$$('#pin-input').value;
+ this.fire('submit', { pin: pin });
+ },
+
+ // Called when a key event is pressed while the input element has focus.
+ onInputKeyDown_: function(event) {
+ // Up/down pressed, swallow the event to prevent the input value from
+ // being incremented or decremented.
+ if (event.keyCode == 38 || event.keyCode == 40)
+ event.preventDefault();
+
+ // Enter pressed.
+ if (event.keyCode == 13) {
+ this.onPinSubmit_();
+ event.preventDefault();
+ }
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698