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..1f69be47551f5903067af048a573fb21ad0cc018 |
--- /dev/null |
+++ b/ui/keyboard/resources/send_key_event.js |
@@ -0,0 +1,18 @@ |
+// Copyright (c) 2013 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. |
+ |
+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); |
+} |