OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "ui/base/ime/input_method_base.h" | 5 #include "ui/base/ime/input_method_base.h" |
6 | 6 |
7 #ifndef UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ | 7 #ifndef UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ |
8 #define UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ | 8 #define UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 #include "services/shell/public/cpp/connector.h" |
| 13 #include "services/ui/public/interfaces/ime.mojom.h" |
11 #include "ui/views/mus/mus_export.h" | 14 #include "ui/views/mus/mus_export.h" |
12 | 15 |
13 namespace ui { | 16 namespace ui { |
14 class Window; | 17 class Window; |
15 } // namespace mojo | 18 } // namespace mojo |
16 | 19 |
17 namespace views { | 20 namespace views { |
18 | 21 |
19 class VIEWS_MUS_EXPORT InputMethodMUS : public ui::InputMethodBase { | 22 class TextInputClientImpl; |
| 23 |
| 24 class VIEWS_MUS_EXPORT InputMethodMus : public ui::InputMethodBase { |
20 public: | 25 public: |
21 InputMethodMUS(ui::internal::InputMethodDelegate* delegate, | 26 InputMethodMus(ui::internal::InputMethodDelegate* delegate, |
22 ui::Window* window); | 27 ui::Window* window); |
23 ~InputMethodMUS() override; | 28 ~InputMethodMus() override; |
24 | 29 |
25 private: | 30 void Init(shell::Connector* connector); |
| 31 |
26 // Overridden from ui::InputMethod: | 32 // Overridden from ui::InputMethod: |
27 void OnFocus() override; | 33 void OnFocus() override; |
28 void OnBlur() override; | 34 void OnBlur() override; |
29 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, | 35 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, |
30 NativeEventResult* result) override; | 36 NativeEventResult* result) override; |
31 void DispatchKeyEvent(ui::KeyEvent* event) override; | 37 void DispatchKeyEvent(ui::KeyEvent* event) override; |
32 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; | 38 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; |
33 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; | 39 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; |
34 void CancelComposition(const ui::TextInputClient* client) override; | 40 void CancelComposition(const ui::TextInputClient* client) override; |
35 void OnInputLocaleChanged() override; | 41 void OnInputLocaleChanged() override; |
36 std::string GetInputLocale() override; | 42 std::string GetInputLocale() override; |
37 bool IsCandidatePopupOpen() const override; | 43 bool IsCandidatePopupOpen() const override; |
38 | 44 |
| 45 private: |
| 46 friend TextInputClientImpl; |
| 47 |
39 // Overridden from ui::InputMethodBase: | 48 // Overridden from ui::InputMethodBase: |
40 void OnDidChangeFocusedClient(ui::TextInputClient* focused_before, | 49 void OnDidChangeFocusedClient(ui::TextInputClient* focused_before, |
41 ui::TextInputClient* focused) override; | 50 ui::TextInputClient* focused) override; |
42 | 51 |
43 void UpdateTextInputType(); | 52 void UpdateTextInputType(); |
44 | 53 |
45 // The toplevel window which is not owned by this class. | 54 // The toplevel window which is not owned by this class. This may be null |
| 55 // for tests. |
46 ui::Window* window_; | 56 ui::Window* window_; |
47 | 57 |
48 DISALLOW_COPY_AND_ASSIGN(InputMethodMUS); | 58 ui::mojom::IMEServerPtr ime_server_; |
| 59 ui::mojom::InputMethodPtr input_method_; |
| 60 std::unique_ptr<TextInputClientImpl> text_input_client_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(InputMethodMus); |
49 }; | 63 }; |
50 | 64 |
51 } // namespace views | 65 } // namespace views |
52 | 66 |
53 #endif // UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ | 67 #endif // UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ |
OLD | NEW |