Index: ui/base/ime/input_method_auraandroid.cc |
diff --git a/ui/base/ime/input_method_auraandroid.cc b/ui/base/ime/input_method_auraandroid.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..26d39f75523bba4946c49107c44bc5773468f5c4 |
--- /dev/null |
+++ b/ui/base/ime/input_method_auraandroid.cc |
@@ -0,0 +1,72 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/base/ime/input_method_auraandroid.h" |
+ |
+#include "ui/base/ime/text_input_client.h" |
+#include "ui/events/event.h" |
+ |
+// TODO(bshe): This is currently very similar to InputMethodMUS. Consider unify |
+// them in the furture if the two have reasonable similarity. |
+ |
+namespace ui { |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// InputMethodAuraAndroid, public: |
+ |
+InputMethodAuraAndroid::InputMethodAuraAndroid( |
+ internal::InputMethodDelegate* delegate) { |
+ SetDelegate(delegate); |
mfomitchev
2015/10/15 18:19:59
We don't need to call OnFocus() here like we do in
bshe
2015/10/15 18:27:14
I want to add it in follow up cls (probably part o
mfomitchev
2015/10/15 18:29:05
Acknowledged.
|
+} |
+ |
+InputMethodAuraAndroid::~InputMethodAuraAndroid() {} |
+ |
+bool InputMethodAuraAndroid::OnUntranslatedIMEMessage( |
+ const base::NativeEvent& event, |
+ NativeEventResult* result) { |
+ return false; |
+} |
+ |
+void InputMethodAuraAndroid::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()) { |
+ 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); |
+ event->StopPropagation(); |
+ return; |
+ } |
+ |
+ ignore_result(DispatchKeyEventPostIME(event)); |
+} |
+ |
+void InputMethodAuraAndroid::OnCaretBoundsChanged( |
+ const ui::TextInputClient* client) { |
+} |
+ |
+void InputMethodAuraAndroid::CancelComposition( |
+ const ui::TextInputClient* client) { |
+} |
+ |
+void InputMethodAuraAndroid::OnInputLocaleChanged() {} |
+ |
+std::string InputMethodAuraAndroid::GetInputLocale() { |
+ return ""; |
+} |
+ |
+bool InputMethodAuraAndroid::IsCandidatePopupOpen() const { |
+ return false; |
+} |
+ |
+} // namespace ui |