OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_ | 5 #ifndef UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_ |
6 #define UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_ | 6 #define UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/base/ime/input_method_observer.h" |
10 #include "ui/platform_window/platform_ime_controller.h" | 11 #include "ui/platform_window/platform_ime_controller.h" |
11 | 12 |
12 namespace ui { | 13 namespace ui { |
| 14 class InputMethod; |
13 | 15 |
14 class PlatformImeControllerAndroid : public PlatformImeController { | 16 class PlatformImeControllerAndroid : public PlatformImeController, |
| 17 public InputMethodObserver { |
15 public: | 18 public: |
16 static bool Register(JNIEnv* env); | 19 static bool Register(JNIEnv* env); |
17 | 20 |
18 PlatformImeControllerAndroid(); | 21 PlatformImeControllerAndroid(); |
19 ~PlatformImeControllerAndroid() override; | 22 ~PlatformImeControllerAndroid() override; |
20 | 23 |
21 // Native methods called by Java code. | 24 // Native methods called by Java code. |
22 void Init(JNIEnv* env, jobject jobj); | 25 void Init(JNIEnv* env, jobject jobj); |
23 | 26 |
| 27 void SetInputMethod(InputMethod* input_method); |
| 28 InputMethod* GetInputMethod() { return input_method_; } |
| 29 |
24 private: | 30 private: |
25 // Overridden from PlatformImeController: | 31 // Overridden from PlatformImeController: |
26 void UpdateTextInputState(const TextInputState& state) override; | 32 void UpdateTextInputState(const TextInputState& state) override; |
27 void SetImeVisibility(bool visible) override; | 33 void SetImeVisibility(bool visible) override; |
28 | 34 |
| 35 // InputMethodObserver: |
| 36 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; |
| 37 void OnFocus() override {} |
| 38 void OnBlur() override {} |
| 39 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {} |
| 40 void OnTextInputStateChanged(const ui::TextInputClient* client) override; |
| 41 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; |
| 42 void OnShowImeIfNeeded() override; |
| 43 |
29 JavaObjectWeakGlobalRef java_platform_ime_controller_android_; | 44 JavaObjectWeakGlobalRef java_platform_ime_controller_android_; |
30 | 45 |
| 46 bool keyboard_visible_; |
| 47 InputMethod* input_method_; |
| 48 |
31 DISALLOW_COPY_AND_ASSIGN(PlatformImeControllerAndroid); | 49 DISALLOW_COPY_AND_ASSIGN(PlatformImeControllerAndroid); |
32 }; | 50 }; |
33 | 51 |
34 } // namespace ui | 52 } // namespace ui |
35 | 53 |
36 #endif // UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_ | 54 #endif // UI_PLATFORM_WINDOW_ANDROID_PLATFORM_IME_CONTROLLER_ANDROID_H_ |
OLD | NEW |