summaryrefslogtreecommitdiffstats
path: root/ui/platform_window
diff options
context:
space:
mode:
authorpenghuang <penghuang@chromium.org>2015-07-27 10:28:53 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-27 17:30:07 +0000
commit3c35f9535d0aa9066738b643c34e2aa7b833265b (patch)
tree1be0c4e0bd7b0429518a1da7c8bda8a299e05a41 /ui/platform_window
parentbda290c881e5375992844e29f25cbea8408aa027 (diff)
downloadchromium_src-3c35f9535d0aa9066738b643c34e2aa7b833265b.zip
chromium_src-3c35f9535d0aa9066738b643c34e2aa7b833265b.tar.gz
chromium_src-3c35f9535d0aa9066738b643c34e2aa7b833265b.tar.bz2
Mandoline: Support text input on Android part 1 of 2.
This CL is a part of CL https://codereview.chromium.org/1209083004/ . It Adds the PlatformImeController in PlatformWindow. It will be used for conmunicating with OS IME system. It also addes the a PlatformImeController implementation for Android. BUG=498624 Review URL: https://codereview.chromium.org/1252563004 Cr-Commit-Position: refs/heads/master@{#340494}
Diffstat (limited to 'ui/platform_window')
-rw-r--r--ui/platform_window/BUILD.gn2
-rw-r--r--ui/platform_window/android/BUILD.gn8
-rw-r--r--ui/platform_window/android/DEPS1
-rw-r--r--ui/platform_window/android/java/src/org/chromium/ui/PlatformImeControllerAndroid.java99
-rw-r--r--ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java21
-rw-r--r--ui/platform_window/android/platform_ime_controller_android.cc47
-rw-r--r--ui/platform_window/android/platform_ime_controller_android.h35
-rw-r--r--ui/platform_window/android/platform_window_android.cc7
-rw-r--r--ui/platform_window/android/platform_window_android.h5
-rw-r--r--ui/platform_window/platform_ime_controller.h23
-rw-r--r--ui/platform_window/platform_window.h5
-rw-r--r--ui/platform_window/stub/stub_window.cc4
-rw-r--r--ui/platform_window/stub/stub_window.h1
-rw-r--r--ui/platform_window/text_input_state.h94
-rw-r--r--ui/platform_window/win/win_window.cc4
-rw-r--r--ui/platform_window/win/win_window.h1
-rw-r--r--ui/platform_window/x11/x11_window.cc4
-rw-r--r--ui/platform_window/x11/x11_window.h1
18 files changed, 357 insertions, 5 deletions
diff --git a/ui/platform_window/BUILD.gn b/ui/platform_window/BUILD.gn
index 3dfdc9a..4a1eb42 100644
--- a/ui/platform_window/BUILD.gn
+++ b/ui/platform_window/BUILD.gn
@@ -6,8 +6,10 @@ import("//build/config/ui.gni")
source_set("platform_window") {
sources = [
+ "platform_ime_controller.h",
"platform_window.h",
"platform_window_delegate.h",
+ "text_input_state.h",
]
deps = [
diff --git a/ui/platform_window/android/BUILD.gn b/ui/platform_window/android/BUILD.gn
index f1448a4..6082f10 100644
--- a/ui/platform_window/android/BUILD.gn
+++ b/ui/platform_window/android/BUILD.gn
@@ -10,6 +10,8 @@ assert(is_android)
component("android") {
output_name = "android_window"
sources = [
+ "platform_ime_controller_android.cc",
+ "platform_ime_controller_android.h",
"platform_window_android.cc",
"platform_window_android.h",
]
@@ -29,13 +31,17 @@ component("android") {
generate_jni("jni_headers") {
sources = [
+ "java/src/org/chromium/ui/PlatformImeControllerAndroid.java",
"java/src/org/chromium/ui/PlatformWindowAndroid.java",
]
jni_package = "android_window"
}
android_library("platform_window_java") {
- java_files = [ "java/src/org/chromium/ui/PlatformWindowAndroid.java" ]
+ java_files = [
+ "java/src/org/chromium/ui/PlatformImeControllerAndroid.java",
+ "java/src/org/chromium/ui/PlatformWindowAndroid.java",
+ ]
deps = [
"//base:base_java",
]
diff --git a/ui/platform_window/android/DEPS b/ui/platform_window/android/DEPS
index 50b51c4..aaf33f8 100644
--- a/ui/platform_window/android/DEPS
+++ b/ui/platform_window/android/DEPS
@@ -2,4 +2,5 @@ include_rules = [
"+jni",
"+ui/events",
"+ui/gfx",
+ "+ui/mojo/ime",
]
diff --git a/ui/platform_window/android/java/src/org/chromium/ui/PlatformImeControllerAndroid.java b/ui/platform_window/android/java/src/org/chromium/ui/PlatformImeControllerAndroid.java
new file mode 100644
index 0000000..9829643
--- /dev/null
+++ b/ui/platform_window/android/java/src/org/chromium/ui/PlatformImeControllerAndroid.java
@@ -0,0 +1,99 @@
+// 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.
+
+package org.chromium.ui;
+
+import android.content.Context;
+import android.view.inputmethod.BaseInputConnection;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputConnection;
+import android.view.inputmethod.InputMethodManager;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Exposes IME related code to native code.
+ */
+@JNINamespace("ui")
+class PlatformImeControllerAndroid {
+ private int mInputType = 0;
+ private int mInputFlags = 0;
+ private String mText = "";
+ private int mSelectionStart = 0;
+ private int mSelectionEnd = 0;
+ private int mCompositionStart = 0;
+ private int mCompositionEnd = 0;
+ private boolean mShowImeIfNeeded = false;
+
+ private final PlatformWindowAndroid mWindow;
+ private final long mNativeHandle;
+ private final InputMethodManager mInputMethodManager;
+ private InputConnection mInputConnection;
+
+ PlatformImeControllerAndroid(PlatformWindowAndroid window, long nativeHandle) {
+ mWindow = window;
+ mNativeHandle = nativeHandle;
+ mInputMethodManager = (InputMethodManager) mWindow.getContext().getSystemService(
+ Context.INPUT_METHOD_SERVICE);
+ assert mNativeHandle != 0;
+ nativeInit(mNativeHandle);
+ }
+
+ boolean isTextEditorType() {
+ return mInputType != 0;
+ }
+
+ InputConnection onCreateInputConnection(EditorInfo outAttrs) {
+ if (mInputType == 0) {
+ // Although onCheckIsTextEditor will return false in this case, the EditorInfo
+ // is still used by the InputMethodService. Need to make sure the IME doesn't
+ // enter fullscreen mode.
+ outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
+ }
+
+ // TODO(penghuang): Support full editor.
+ final boolean fullEditor = false;
+ mInputConnection = new BaseInputConnection(mWindow, fullEditor);
+ outAttrs.actionLabel = null;
+ // TODO(penghuang): Pass blink text input type to Android framework.
+ outAttrs.inputType =
+ EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
+ outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN
+ | EditorInfo.IME_ACTION_GO;
+ return mInputConnection;
+ }
+
+ @CalledByNative
+ private void updateTextInputState(int textInputType, int textInputFlags, String text,
+ int selectionStart, int selectionEnd, int compositionStart, int compositionEnd,
+ boolean showImeIfNeeded) {
+ mInputType = textInputType;
+ mInputFlags = textInputFlags;
+ mText = text;
+ mSelectionStart = selectionStart;
+ mSelectionEnd = selectionEnd;
+ mCompositionStart = compositionStart;
+ mCompositionEnd = compositionEnd;
+ mShowImeIfNeeded = showImeIfNeeded;
+ // Update keyboard visibility
+ if (textInputType == 0) {
+ dismissInput();
+ } else if (showImeIfNeeded) {
+ showKeyboard();
+ }
+ }
+
+ private void showKeyboard() {
+ mInputMethodManager.showSoftInput(mWindow, 0);
+ }
+
+ private void dismissInput() {
+ mInputMethodManager.hideSoftInputFromWindow(mWindow.getWindowToken(), 0);
+ }
+
+ // The generated native method implementation will call
+ // PlatformImeControllerAndroid::Init(JNIEnv* env, jobject self)
+ private native void nativeInit(long nativePlatformImeControllerAndroid);
+}
diff --git a/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java b/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java
index 19d96b4..6fe0b1c 100644
--- a/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java
+++ b/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java
@@ -12,6 +12,8 @@ import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputConnection;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
@@ -24,16 +26,18 @@ public class PlatformWindowAndroid extends SurfaceView {
private long mNativeMojoViewport;
private final SurfaceHolder.Callback mSurfaceCallback;
+ private final PlatformImeControllerAndroid mImeController;
@CalledByNative
public static PlatformWindowAndroid createForActivity(
- Activity activity, long nativeViewport) {
- PlatformWindowAndroid rv = new PlatformWindowAndroid(activity, nativeViewport);
+ Activity activity, long nativeViewport, long nativeImeController) {
+ PlatformWindowAndroid rv =
+ new PlatformWindowAndroid(activity, nativeViewport, nativeImeController);
activity.setContentView(rv);
return rv;
}
- public PlatformWindowAndroid(Context context, long nativeViewport) {
+ public PlatformWindowAndroid(Context context, long nativeViewport, long nativeImeController) {
super(context);
setFocusable(true);
@@ -65,6 +69,7 @@ public class PlatformWindowAndroid extends SurfaceView {
};
getHolder().addCallback(mSurfaceCallback);
+ mImeController = new PlatformImeControllerAndroid(this, nativeImeController);
}
@CalledByNative
@@ -101,6 +106,16 @@ public class PlatformWindowAndroid extends SurfaceView {
}
@Override
+ public boolean onCheckIsTextEditor() {
+ return mImeController.isTextEditorType();
+ }
+
+ @Override
+ public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
+ return mImeController.onCreateInputConnection(outAttrs);
+ }
+
+ @Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (privateDispatchKeyEvent(event)) {
return true;
diff --git a/ui/platform_window/android/platform_ime_controller_android.cc b/ui/platform_window/android/platform_ime_controller_android.cc
new file mode 100644
index 0000000..832a76e
--- /dev/null
+++ b/ui/platform_window/android/platform_ime_controller_android.cc
@@ -0,0 +1,47 @@
+// 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/platform_window/android/platform_ime_controller_android.h"
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "jni/PlatformImeControllerAndroid_jni.h"
+
+namespace ui {
+
+// static
+bool PlatformImeControllerAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+PlatformImeControllerAndroid::PlatformImeControllerAndroid() {
+}
+
+PlatformImeControllerAndroid::~PlatformImeControllerAndroid() {
+}
+
+void PlatformImeControllerAndroid::Init(JNIEnv* env, jobject jobj) {
+ DCHECK(java_platform_ime_controller_android_.is_empty());
+ java_platform_ime_controller_android_ = JavaObjectWeakGlobalRef(env, jobj);
+}
+
+void PlatformImeControllerAndroid::UpdateTextInputState(
+ const TextInputState& state) {
+ if (java_platform_ime_controller_android_.is_empty())
+ return;
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_PlatformImeControllerAndroid_updateTextInputState(
+ env,
+ java_platform_ime_controller_android_.get(env).obj(),
+ state.type,
+ state.flags,
+ base::android::ConvertUTF8ToJavaString(env, state.text).obj(),
+ state.selection_start,
+ state.selection_end,
+ state.composition_start,
+ state.composition_end,
+ state.show_ime_if_needed);
+}
+
+} // namespace ui
diff --git a/ui/platform_window/android/platform_ime_controller_android.h b/ui/platform_window/android/platform_ime_controller_android.h
new file mode 100644
index 0000000..244b728
--- /dev/null
+++ b/ui/platform_window/android/platform_ime_controller_android.h
@@ -0,0 +1,35 @@
+// 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.
+
+#ifndef UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_
+#define UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_
+
+#include "base/android/jni_weak_ref.h"
+#include "base/macros.h"
+#include "ui/platform_window/platform_ime_controller.h"
+
+namespace ui {
+
+class PlatformImeControllerAndroid : public PlatformImeController {
+ public:
+ static bool Register(JNIEnv* env);
+
+ PlatformImeControllerAndroid();
+ ~PlatformImeControllerAndroid() override;
+
+ // Native methods called by Java code.
+ void Init(JNIEnv* env, jobject jobj);
+
+ private:
+ // Overridden from PlatformImeController:
+ void UpdateTextInputState(const TextInputState& state) override;
+
+ JavaObjectWeakGlobalRef java_platform_ime_controller_android_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformImeControllerAndroid);
+};
+
+} // namespace ui
+
+#endif // UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_
diff --git a/ui/platform_window/android/platform_window_android.cc b/ui/platform_window/android/platform_window_android.cc
index 0b34927c1..5101948 100644
--- a/ui/platform_window/android/platform_window_android.cc
+++ b/ui/platform_window/android/platform_window_android.cc
@@ -158,7 +158,8 @@ void PlatformWindowAndroid::Show() {
java_platform_window_android_ = JavaObjectWeakGlobalRef(
env, Java_PlatformWindowAndroid_createForActivity(
env, base::android::GetApplicationContext(),
- reinterpret_cast<jlong>(this)).obj());
+ reinterpret_cast<jlong>(this),
+ reinterpret_cast<jlong>(&platform_ime_controller_)).obj());
}
void PlatformWindowAndroid::Hide() {
@@ -213,4 +214,8 @@ void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) {
NOTIMPLEMENTED();
}
+PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() {
+ return &platform_ime_controller_;
+}
+
} // namespace ui
diff --git a/ui/platform_window/android/platform_window_android.h b/ui/platform_window/android/platform_window_android.h
index 0e33068..2731126 100644
--- a/ui/platform_window/android/platform_window_android.h
+++ b/ui/platform_window/android/platform_window_android.h
@@ -12,6 +12,7 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/sequential_id_generator.h"
+#include "ui/platform_window/android/platform_ime_controller_android.h"
#include "ui/platform_window/platform_window.h"
struct ANativeWindow;
@@ -54,6 +55,7 @@ class PlatformWindowAndroid : public PlatformWindow {
bool pressed,
jint key_code,
jint unicode_character);
+
private:
void ReleaseWindow();
@@ -72,6 +74,7 @@ class PlatformWindowAndroid : public PlatformWindow {
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+ PlatformImeController* GetPlatformImeController() override;
PlatformWindowDelegate* delegate_;
@@ -81,6 +84,8 @@ class PlatformWindowAndroid : public PlatformWindow {
gfx::Size size_; // Origin is always (0,0)
+ PlatformImeControllerAndroid platform_ime_controller_;
+
base::WeakPtrFactory<PlatformWindowAndroid> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PlatformWindowAndroid);
diff --git a/ui/platform_window/platform_ime_controller.h b/ui/platform_window/platform_ime_controller.h
new file mode 100644
index 0000000..44e079c
--- /dev/null
+++ b/ui/platform_window/platform_ime_controller.h
@@ -0,0 +1,23 @@
+// 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.
+
+#ifndef UI_PLATFORM_WINDOW_PLATFORM_IME_CONTROLLER_H_
+#define UI_PLATFORM_WINDOW_PLATFORM_IME_CONTROLLER_H_
+
+#include "ui/platform_window/text_input_state.h"
+
+namespace ui {
+
+// Platform input method editor controller.
+class PlatformImeController {
+ public:
+ virtual ~PlatformImeController() {}
+
+ // Update the text input state.
+ virtual void UpdateTextInputState(const TextInputState& state) = 0;
+};
+
+} // namespace ui
+
+#endif // UI_PLATFORM_WINDOW_PLATFORM_IME_CONTROLLER_H_
diff --git a/ui/platform_window/platform_window.h b/ui/platform_window/platform_window.h
index 6e6ace1..67d3206 100644
--- a/ui/platform_window/platform_window.h
+++ b/ui/platform_window/platform_window.h
@@ -14,6 +14,7 @@ class Rect;
namespace ui {
+class PlatformImeController;
class PlatformWindowDelegate;
// Platform window.
@@ -49,6 +50,10 @@ class PlatformWindow {
// Confines the cursor to |bounds| when it is in the platform window. |bounds|
// is in platform window coordinates.
virtual void ConfineCursorToBounds(const gfx::Rect& bounds) = 0;
+
+ // The PlatformImeController is owned by the PlatformWindow, the ownership is
+ // not transferred.
+ virtual PlatformImeController* GetPlatformImeController() = 0;
};
} // namespace ui
diff --git a/ui/platform_window/stub/stub_window.cc b/ui/platform_window/stub/stub_window.cc
index cace198..36b378b 100644
--- a/ui/platform_window/stub/stub_window.cc
+++ b/ui/platform_window/stub/stub_window.cc
@@ -63,4 +63,8 @@ void StubWindow::MoveCursorTo(const gfx::Point& location) {
void StubWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
}
+PlatformImeController* StubWindow::GetPlatformImeController() {
+ return nullptr;
+}
+
} // namespace ui
diff --git a/ui/platform_window/stub/stub_window.h b/ui/platform_window/stub/stub_window.h
index 7c68cd6..8caa85c 100644
--- a/ui/platform_window/stub/stub_window.h
+++ b/ui/platform_window/stub/stub_window.h
@@ -32,6 +32,7 @@ class STUB_WINDOW_EXPORT StubWindow : public PlatformWindow {
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+ PlatformImeController* GetPlatformImeController() override;
PlatformWindowDelegate* delegate_;
gfx::Rect bounds_;
diff --git a/ui/platform_window/text_input_state.h b/ui/platform_window/text_input_state.h
new file mode 100644
index 0000000..97e2b56
--- /dev/null
+++ b/ui/platform_window/text_input_state.h
@@ -0,0 +1,94 @@
+// 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.
+
+#ifndef UI_PLATFORM_WINDOW_TEXT_INPUT_STATE_H_
+#define UI_PLATFORM_WINDOW_TEXT_INPUT_STATE_H_
+
+#include <string>
+
+namespace ui {
+
+// Text input type which is based on blink::WebTextInputType.
+enum TextInputType {
+ TEXT_INPUT_TYPE_NONE,
+ TEXT_INPUT_TYPE_TEXT,
+ TEXT_INPUT_TYPE_PASSWORD,
+ TEXT_INPUT_TYPE_SEARCH,
+ TEXT_INPUT_TYPE_EMAIL,
+ TEXT_INPUT_TYPE_NUMBER,
+ TEXT_INPUT_TYPE_TELEPHONE,
+ TEXT_INPUT_TYPE_URL,
+ TEXT_INPUT_TYPE_DATE,
+ TEXT_INPUT_TYPE_DATE_TIME,
+ TEXT_INPUT_TYPE_DATE_TIME_LOCAL,
+ TEXT_INPUT_TYPE_MONTH,
+ TEXT_INPUT_TYPE_TIME,
+ TEXT_INPUT_TYPE_WEEK,
+ TEXT_INPUT_TYPE_TEXT_AREA,
+ TEXT_INPUT_TYPE_LAST = TEXT_INPUT_TYPE_TEXT_AREA,
+};
+
+// Text input flag which is based on blink::WebTextInputFlags.
+enum TextInputFlag {
+ TEXT_INPUT_FLAG_NONE,
+ TEXT_INPUT_FLAG_AUTO_COMPLETE_ON = 1 << 0,
+ TEXT_INPUT_FLAG_AUTO_COMPLETE_OFF = 1 << 1,
+ TEXT_INPUT_FLAG_AUTO_CORRECT_ON = 1 << 2,
+ TEXT_INPUT_FLAG_AUTO_CORRECT_OFF = 1 << 3,
+ TEXT_INPUT_FLAG_SPELL_CHECK_ON = 1 << 4,
+ TEXT_INPUT_FLAG_SPELL_CHECK_OFF = 1 << 5,
+ TEXT_INPUT_FLAG_AUTO_CAPITALIZE_NONE = 1 << 6,
+ TEXT_INPUT_FLAG_AUTO_CAPITALIZE_CHARACTERS = 1 << 7,
+ TEXT_INPUT_FLAG_AUTO_CAPITALIZE_WORDS = 1 << 8,
+ TEXT_INPUT_FLAG_AUTO_CAPITALIZE_SENTENCES = 1 << 9,
+ TEXT_INPUT_FLAG_ALL = (TEXT_INPUT_FLAG_AUTO_CAPITALIZE_SENTENCES << 1) - 1,
+};
+
+// Text input info which is based on blink::WebTextInputInfo.
+struct TextInputState {
+ TextInputState()
+ : type(TEXT_INPUT_TYPE_NONE),
+ flags(TEXT_INPUT_FLAG_NONE),
+ selection_start(0),
+ selection_end(0),
+ composition_start(0),
+ composition_end(0),
+ can_compose_inline(false),
+ show_ime_if_needed(false) {}
+
+ // The type of input field.
+ TextInputType type;
+
+ // The flags of the input field (autocorrect, autocomplete, etc.).
+ int flags;
+
+ // The value of the input field.
+ std::string text;
+
+ // The cursor position of the current selection start, or the caret position
+ // if nothing is selected.
+ int selection_start;
+
+ // The cursor position of the current selection end, or the caret position
+ // if nothing is selected.
+ int selection_end;
+
+ // The start position of the current composition, or -1 if there is none.
+ int composition_start;
+
+ // The end position of the current composition, or -1 if there is none.
+ int composition_end;
+
+ // Whether or not inline composition can be performed for the current input.
+ bool can_compose_inline;
+
+ // Whether or not the IME should be shown as a result of this update. Even if
+ // true, the IME will only be shown if the type is appropriate (e.g. not
+ // TEXT_INPUT_TYPE_NONE).
+ bool show_ime_if_needed;
+};
+
+} // namespace ui
+
+#endif // UI_PLATFORM_WINDOW_TEXT_INPUT_STATE_H_
diff --git a/ui/platform_window/win/win_window.cc b/ui/platform_window/win/win_window.cc
index c2554d4..fd65bba 100644
--- a/ui/platform_window/win/win_window.cc
+++ b/ui/platform_window/win/win_window.cc
@@ -109,6 +109,10 @@ void WinWindow::MoveCursorTo(const gfx::Point& location) {}
void WinWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
}
+PlatformImeController* WinWindow::GetPlatformImeController() {
+ return nullptr;
+}
+
LRESULT WinWindow::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile(
diff --git a/ui/platform_window/win/win_window.h b/ui/platform_window/win/win_window.h
index 8fb8adc..eb02ca9 100644
--- a/ui/platform_window/win/win_window.h
+++ b/ui/platform_window/win/win_window.h
@@ -36,6 +36,7 @@ class WIN_WINDOW_EXPORT WinWindow : public NON_EXPORTED_BASE(PlatformWindow),
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+ PlatformImeController* GetPlatformImeController() override;
CR_BEGIN_MSG_MAP_EX(WinWindow)
CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
index 747581700..1e94ae2 100644
--- a/ui/platform_window/x11/x11_window.cc
+++ b/ui/platform_window/x11/x11_window.cc
@@ -260,6 +260,10 @@ void X11Window::MoveCursorTo(const gfx::Point& location) {}
void X11Window::ConfineCursorToBounds(const gfx::Rect& bounds) {
}
+PlatformImeController* X11Window::GetPlatformImeController() {
+ return nullptr;
+}
+
bool X11Window::CanDispatchEvent(const PlatformEvent& event) {
return FindXEventTarget(event) == xwindow_;
}
diff --git a/ui/platform_window/x11/x11_window.h b/ui/platform_window/x11/x11_window.h
index 0b6b9cb..6d422c7 100644
--- a/ui/platform_window/x11/x11_window.h
+++ b/ui/platform_window/x11/x11_window.h
@@ -43,6 +43,7 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+ PlatformImeController* GetPlatformImeController() override;
// PlatformEventDispatcher:
bool CanDispatchEvent(const PlatformEvent& event) override;