Index: ui/keyboard/resources/api_adapter.js |
diff --git a/ui/keyboard/resources/api_adapter.js b/ui/keyboard/resources/api_adapter.js |
index cd64f57d512088a8067c069761218caa83127797..4cfd98fe1137b2ee4f96dc1734792aa5f2484c9e 100644 |
--- a/ui/keyboard/resources/api_adapter.js |
+++ b/ui/keyboard/resources/api_adapter.js |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Copyright 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. |
@@ -11,3 +11,12 @@ function logIfError() { |
function insertText(text) { |
chrome.experimental.input.virtualKeyboard.insertText(text, logIfError); |
} |
+ |
+function dispatchKeyEvent(type, char) { |
+ if (!char || char.length != 1) |
+ console.error('Invalid character.'); |
+ var charCode = char.charCodeAt(0); |
+ chrome.experimental.input.virtualKeyboard.dispatchKeyEvent(type, |
+ charCode, |
+ logIfError); |
+} |