OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_ |
6 #define COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_ | 6 #define COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "components/arc/arc_bridge_service.h" | 10 #include "components/arc/arc_bridge_service.h" |
11 #include "components/arc/common/ime.mojom.h" | 11 #include "components/arc/common/ime.mojom.h" |
12 #include "components/arc/ime/arc_ime_bridge.h" | 12 #include "components/arc/ime/arc_ime_bridge.h" |
| 13 #include "components/arc/instance_holder.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "ui/base/ime/text_input_type.h" | 15 #include "ui/base/ime/text_input_type.h" |
15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
16 | 17 |
17 namespace ui { | 18 namespace ui { |
18 struct CompositionText; | 19 struct CompositionText; |
19 } // namespace ui | 20 } // namespace ui |
20 | 21 |
21 namespace arc { | 22 namespace arc { |
22 | 23 |
23 // This class encapsulates the detail of IME related IPC between | 24 // This class encapsulates the detail of IME related IPC between |
24 // Chromium and the ARC container. | 25 // Chromium and the ARC container. |
25 class ArcImeBridgeImpl : public ArcImeBridge, | 26 class ArcImeBridgeImpl : public ArcImeBridge, |
26 public mojom::ImeHost, | 27 public mojom::ImeHost, |
27 public ArcBridgeService::Observer { | 28 public InstanceHolder<mojom::ImeInstance>::Observer { |
28 public: | 29 public: |
29 ArcImeBridgeImpl(Delegate* delegate, ArcBridgeService* bridge_service); | 30 ArcImeBridgeImpl(Delegate* delegate, ArcBridgeService* bridge_service); |
30 ~ArcImeBridgeImpl() override; | 31 ~ArcImeBridgeImpl() override; |
31 | 32 |
32 // arc::ArcBridgeService::Observer overrides: | 33 // arc::InstanceHolder<mojom::ImeInstance>::Observer overrides: |
33 void OnImeInstanceReady() override; | 34 void OnInstanceReady() override; |
34 | 35 |
35 // ArcImeBridge overrides: | 36 // ArcImeBridge overrides: |
36 void SendSetCompositionText(const ui::CompositionText& composition) override; | 37 void SendSetCompositionText(const ui::CompositionText& composition) override; |
37 void SendConfirmCompositionText() override; | 38 void SendConfirmCompositionText() override; |
38 void SendInsertText(const base::string16& text) override; | 39 void SendInsertText(const base::string16& text) override; |
39 void SendOnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 40 void SendOnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
40 void SendExtendSelectionAndDelete(size_t before, size_t after) override; | 41 void SendExtendSelectionAndDelete(size_t before, size_t after) override; |
41 | 42 |
42 // arc::mojom::ImeHost overrides: | 43 // arc::mojom::ImeHost overrides: |
43 void OnTextInputTypeChanged(arc::mojom::TextInputType type) override; | 44 void OnTextInputTypeChanged(arc::mojom::TextInputType type) override; |
44 void OnCursorRectChanged(arc::mojom::CursorRectPtr rect) override; | 45 void OnCursorRectChanged(arc::mojom::CursorRectPtr rect) override; |
45 void OnCancelComposition() override; | 46 void OnCancelComposition() override; |
46 void ShowImeIfNeeded() override; | 47 void ShowImeIfNeeded() override; |
47 | 48 |
48 private: | 49 private: |
49 mojo::Binding<mojom::ImeHost> binding_; | 50 mojo::Binding<mojom::ImeHost> binding_; |
50 Delegate* const delegate_; | 51 Delegate* const delegate_; |
51 ArcBridgeService* const bridge_service_; | 52 ArcBridgeService* const bridge_service_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(ArcImeBridgeImpl); | 54 DISALLOW_COPY_AND_ASSIGN(ArcImeBridgeImpl); |
54 }; | 55 }; |
55 | 56 |
56 } // namespace arc | 57 } // namespace arc |
57 | 58 |
58 #endif // COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_ | 59 #endif // COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_ |
OLD | NEW |