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

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

Issue 1394883004: Introduce InputMethodAuraAndroid for Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reviews Created 5 years, 2 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 | « ui/base/ime/input_method_android.h ('k') | ui/base/ime/input_method_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/input_method_android.cc
diff --git a/ui/base/ime/input_method_android.cc b/ui/base/ime/input_method_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c3e450138a44855de65c5c1e44fcc2c8daced3f6
--- /dev/null
+++ b/ui/base/ime/input_method_android.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_android.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 {
+
+////////////////////////////////////////////////////////////////////////////////
+// InputMethodAndroid, public:
+
+InputMethodAndroid::InputMethodAndroid(
+ internal::InputMethodDelegate* delegate) {
+ SetDelegate(delegate);
+}
+
+InputMethodAndroid::~InputMethodAndroid() {}
+
+bool InputMethodAndroid::OnUntranslatedIMEMessage(
+ const base::NativeEvent& event,
+ NativeEventResult* result) {
+ return false;
+}
+
+void InputMethodAndroid::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()) {
Shu Chen 2015/10/21 01:54:23 Are you sure this is the case for Android? I suppo
bshe 2015/10/21 14:20:25 This is basically a copy of InputMethodMUS. In aur
+ GetTextInputClient()->InsertChar(*event);
+ event->StopPropagation();
+ return;
+ }
+
+ ignore_result(DispatchKeyEventPostIME(event));
+}
+
+void InputMethodAndroid::OnCaretBoundsChanged(
+ const ui::TextInputClient* client) {
+}
+
+void InputMethodAndroid::CancelComposition(
+ const ui::TextInputClient* client) {
+}
+
+void InputMethodAndroid::OnInputLocaleChanged() {}
+
+std::string InputMethodAndroid::GetInputLocale() {
+ return "";
+}
+
+bool InputMethodAndroid::IsCandidatePopupOpen() const {
+ return false;
+}
+
+} // namespace ui
« no previous file with comments | « ui/base/ime/input_method_android.h ('k') | ui/base/ime/input_method_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698