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

Unified Diff: ui/keyboard/resources/send_key_event.js

Issue 14161009: WebUIHandler for chrome://keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: ui/keyboard/resources/send_key_event.js
diff --git a/ui/keyboard/resources/send_key_event.js b/ui/keyboard/resources/send_key_event.js
new file mode 100644
index 0000000000000000000000000000000000000000..8be91471f19b88da2bce13b030f7c8ba2f96b6c9
--- /dev/null
+++ b/ui/keyboard/resources/send_key_event.js
@@ -0,0 +1,14 @@
+function logIfError() {
+ if (chrome.runtime.lastError) {
+ console.log(chrome.runtime.lastError);
+ }
+}
+
+function sendKeyEvent(keyEvent) {
+ keyEvent.type = 'keydown';
+ chrome.experimental.input.virtualKeyboard.sendKeyboardEvent(keyEvent,
+ logIfError);
+ keyEvent.type = 'keyup';
+ chrome.experimental.input.virtualKeyboard.sendKeyboardEvent(keyEvent,
+ logIfError);
+}

Powered by Google App Engine
This is Rietveld 408576698