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