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