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

Unified Diff: mandoline/ui/aura/input_method_mandoline.cc

Issue 1257603006: Refactoring for the InputMethod & InputMethodDelegate interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Sadrul's comment. Created 5 years, 4 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 | « mandoline/ui/aura/input_method_mandoline.h ('k') | mandoline/ui/aura/native_widget_view_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/ui/aura/input_method_mandoline.cc
diff --git a/mandoline/ui/aura/input_method_mandoline.cc b/mandoline/ui/aura/input_method_mandoline.cc
index f1b510bd9ddbb14161b80385435c9f295fc05186..5857466112d1f512612d6e9f6673fde83a6f42e8 100644
--- a/mandoline/ui/aura/input_method_mandoline.cc
+++ b/mandoline/ui/aura/input_method_mandoline.cc
@@ -28,25 +28,27 @@ bool InputMethodMandoline::OnUntranslatedIMEMessage(
return false;
}
-bool InputMethodMandoline::DispatchKeyEvent(const ui::KeyEvent& event) {
- DCHECK(event.type() == ui::ET_KEY_PRESSED ||
- event.type() == ui::ET_KEY_RELEASED);
+void InputMethodMandoline::DispatchKeyEvent(ui::KeyEvent* event) {
+ DCHECK(event->type() == ui::ET_KEY_PRESSED ||
+ event->type() == ui::ET_KEY_RELEASED);
// If no text input client, do nothing.
- if (!GetTextInputClient())
- return DispatchKeyEventPostIME(event);
+ if (!GetTextInputClient()) {
+ ignore_result(DispatchKeyEventPostIME(event));
+ return;
+ }
// Here is where we change the differ from our base class's logic. Instead of
// always dispatching a key down event, and then sending a synthesized
// character event, we instead check to see if this is a character event and
// send out the key if it is. (We fallback to normal dispatch if it isn't.)
- if (event.is_char()) {
- GetTextInputClient()->InsertChar(event.GetCharacter(), event.flags());
-
- return false;
+ if (event->is_char()) {
+ GetTextInputClient()->InsertChar(event->GetCharacter(), event->flags());
+ event->StopPropagation();
+ return;
}
- return DispatchKeyEventPostIME(event);
+ ignore_result(DispatchKeyEventPostIME(event));
}
void InputMethodMandoline::OnCaretBoundsChanged(
« no previous file with comments | « mandoline/ui/aura/input_method_mandoline.h ('k') | mandoline/ui/aura/native_widget_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698