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

Unified Diff: ui/aura/mus/input_method_mus.cc

Issue 2767103004: Makes InputMethodMus deal correctly with focus changes (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | ui/aura/mus/input_method_mus_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/input_method_mus.cc
diff --git a/ui/aura/mus/input_method_mus.cc b/ui/aura/mus/input_method_mus.cc
index d86152d6c9416e800edebe4f7ee5b214792f0aab..c67c2228856e50ebafc545105de9f43de899ebb0 100644
--- a/ui/aura/mus/input_method_mus.cc
+++ b/ui/aura/mus/input_method_mus.cc
@@ -195,6 +195,12 @@ void InputMethodMus::AckPendingCallbacksUnhandled() {
void InputMethodMus::ProcessKeyEventCallback(
const ui::KeyEvent& event,
bool handled) {
+ // Remove the callback as DispatchKeyEventPostIME() may lead to calling
+ // AckPendingCallbacksUnhandled(), which mutates |pending_callbacks_|.
+ DCHECK(!pending_callbacks_.empty());
+ std::unique_ptr<EventResultCallback> ack_callback =
+ std::move(pending_callbacks_.front());
+ pending_callbacks_.pop_front();
EventResult event_result;
if (!handled) {
// If not handled by IME, try dispatching the event to delegate to see if
@@ -207,10 +213,6 @@ void InputMethodMus::ProcessKeyEventCallback(
} else {
event_result = EventResult::HANDLED;
}
- DCHECK(!pending_callbacks_.empty());
- std::unique_ptr<EventResultCallback> ack_callback =
- std::move(pending_callbacks_.front());
- pending_callbacks_.pop_front();
// |ack_callback| can be null if the standard form of DispatchKeyEvent() is
// called instead of the version which provides a callback. In mus+ash we
// use the version with callback, but some unittests use the standard form.
« no previous file with comments | « no previous file | ui/aura/mus/input_method_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698