Index: chrome/browser/ui/input_method/input_method_engine.cc |
diff --git a/chrome/browser/ui/input_method/input_method_engine.cc b/chrome/browser/ui/input_method/input_method_engine.cc |
index a8c62140216380605bef34bded1001db2a0bfe98..644ad0a1d95cf3be875c3b1f99a32157992440ef 100644 |
--- a/chrome/browser/ui/input_method/input_method_engine.cc |
+++ b/chrome/browser/ui/input_method/input_method_engine.cc |
@@ -8,6 +8,7 @@ |
#include "ui/base/ime/composition_text.h" |
#include "ui/base/ime/ime_bridge.h" |
#include "ui/base/ime/ime_input_context_handler_interface.h" |
+#include "ui/events/keycodes/keyboard_code_conversion.h" |
namespace { |
@@ -30,13 +31,6 @@ InputMethodEngine::~InputMethodEngine() { |
CloseImeWindows(); |
} |
-bool InputMethodEngine::SendKeyEvents( |
- int context_id, |
- const std::vector<KeyboardEvent>& events) { |
- // TODO(azurewei) Implement SendKeyEvents funciton |
- return false; |
-} |
- |
bool InputMethodEngine::IsActive() const { |
return true; |
} |
@@ -189,4 +183,19 @@ ui::ImeWindow* InputMethodEngine::FindWindowById(int window_id) const { |
return nullptr; |
} |
+bool InputMethodEngine::SendKeyEvent(ui::KeyEvent* event, |
+ const std::string& code) { |
+ DCHECK(event); |
+ if (event->key_code() == ui::VKEY_UNKNOWN) |
+ event->set_key_code(ui::DomCodeToUsLayoutKeyboardCode(event->code())); |
+ |
+ ui::IMEInputContextHandlerInterface* input_context = |
+ ui::IMEBridge::Get()->GetInputContextHandler(); |
+ if (!input_context) |
+ return false; |
+ input_context->SendKeyEvent(event); |
+ |
+ return true; |
+} |
+ |
} // namespace input_method |