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