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

Unified Diff: ui/base/ime/input_method_base.cc

Issue 2077783002: Make limitations for input.ime.sendKeyEvents API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check lastError of sendKeyEvents. Created 4 years, 6 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/base/ime/input_method_base.cc
diff --git a/ui/base/ime/input_method_base.cc b/ui/base/ime/input_method_base.cc
index 282b6c4f9ad5434ab6eef5d541eea02a8245d12b..ec9ce81e171b2ab96a8717aa7c7ea5fb5c64784f 100644
--- a/ui/base/ime/input_method_base.cc
+++ b/ui/base/ime/input_method_base.cc
@@ -28,6 +28,12 @@ InputMethodBase::~InputMethodBase() {
if (ui::IMEBridge::Get() &&
ui::IMEBridge::Get()->GetInputContextHandler() == this)
ui::IMEBridge::Get()->SetInputContextHandler(nullptr);
+
+ if (!key_events_for_testing_.empty()) {
Devlin 2016/06/23 18:43:22 Why not just std::vector<std::unique_ptr<KeyEvent>
Azure Wei 2016/06/24 06:38:19 Done. Updated with ScopedVector.
+ for (auto key : key_events_for_testing_)
+ delete key;
+ key_events_for_testing_.clear();
+ }
}
void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) {
@@ -199,8 +205,19 @@ void InputMethodBase::DeleteSurroundingText(int32_t offset, uint32_t length) {}
void InputMethodBase::SendKeyEvent(KeyEvent* event) {
sending_key_event_ = true;
+ if (track_key_events_for_testing_) {
+ key_events_for_testing_.push_back(new KeyEvent(*event));
+ }
DispatchKeyEvent(event);
sending_key_event_ = false;
}
+InputMethod* InputMethodBase::GetInputMethod() {
+ return this;
+}
+
+std::vector<ui::KeyEvent*> InputMethodBase::GetKeyEventsForTesting() {
+ return key_events_for_testing_;
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698