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

Unified Diff: chrome/browser/ui/views/ime_driver/remote_text_input_client.cc

Issue 2957173004: Make DispatchKeyEventPostIME() asynchronous.
Patch Set: cleanup. Created 3 years, 5 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/views/ime_driver/remote_text_input_client.cc
diff --git a/chrome/browser/ui/views/ime_driver/remote_text_input_client.cc b/chrome/browser/ui/views/ime_driver/remote_text_input_client.cc
index 93b7ff266c34fc7c22c56d7039bd07329d247472..81b56e9295c23f6176ea406eaaccb9fcba2939ce 100644
--- a/chrome/browser/ui/views/ime_driver/remote_text_input_client.cc
+++ b/chrome/browser/ui/views/ime_driver/remote_text_input_client.cc
@@ -170,3 +170,30 @@ void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent(
// TODO(moshayedi): crbug.com/631527.
NOTIMPLEMENTED();
}
+
+ui::EventDispatchDetails RemoteTextInputClient::DispatchKeyEventPostIME(
+ ui::KeyEvent* event) {
+ return DispatchKeyEventPostIME(event, nullptr);
+}
+
+ui::EventDispatchDetails RemoteTextInputClient::DispatchKeyEventPostIME(
+ ui::KeyEvent* event,
+ std::unique_ptr<base::Callback<void(bool)>> ack_callback) {
+ pending_callbacks_.push_back(std::move(ack_callback));
+ remote_client_->DispatchKeyEventPostIME(
+ ui::Event::Clone(*event),
+ base::Bind(&RemoteTextInputClient::DispatchKeyEventPostIMECallback,
+ base::Unretained(this)));
+ return ui::EventDispatchDetails();
+}
+
+void RemoteTextInputClient::DispatchKeyEventPostIMECallback(
+ bool stopped_propagation) {
+ DCHECK(!pending_callbacks_.empty());
+ std::unique_ptr<base::Callback<void(bool)>> ack_callback =
+ std::move(pending_callbacks_.front());
+ pending_callbacks_.pop_front();
+
+ if (ack_callback)
+ ack_callback->Run(stopped_propagation);
+}

Powered by Google App Engine
This is Rietveld 408576698