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

Unified Diff: chrome/browser/ui/input_method/input_method_engine.cc

Issue 1771173002: Implement input.ime.sendKeyEvents API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failure. Created 4 years, 9 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/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
« no previous file with comments | « chrome/browser/ui/input_method/input_method_engine.h ('k') | chrome/browser/ui/input_method/input_method_engine_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698