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_H_ | 5 #ifndef COMPONENTS_ARC_IME_ARC_IME_BRIDGE_H_ |
6 #define COMPONENTS_ARC_IME_ARC_IME_BRIDGE_H_ | 6 #define COMPONENTS_ARC_IME_ARC_IME_BRIDGE_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 "ui/base/ime/text_input_type.h" | 10 #include "ui/base/ime/text_input_type.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
| 13 class Range; |
13 class Rect; | 14 class Rect; |
14 } // namespace gfx | 15 } // namespace gfx |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 struct CompositionText; | 18 struct CompositionText; |
18 } // namespace ui | 19 } // namespace ui |
19 | 20 |
20 namespace arc { | 21 namespace arc { |
21 | 22 |
22 // This interface class encapsulates the detail of IME related IPC between | 23 // This interface class encapsulates the detail of IME related IPC between |
23 // Chromium and the ARC container. | 24 // Chromium and the ARC container. |
24 class ArcImeBridge { | 25 class ArcImeBridge { |
25 public: | 26 public: |
26 virtual ~ArcImeBridge() {} | 27 virtual ~ArcImeBridge() {} |
27 | 28 |
28 // Received IPCs are deserialized and passed to this delegate. | 29 // Received IPCs are deserialized and passed to this delegate. |
29 class Delegate { | 30 class Delegate { |
30 public: | 31 public: |
31 virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0; | 32 virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0; |
32 virtual void OnCursorRectChanged(const gfx::Rect& rect) = 0; | 33 virtual void OnCursorRectChanged(const gfx::Rect& rect) = 0; |
33 virtual void OnCancelComposition() = 0; | 34 virtual void OnCancelComposition() = 0; |
34 virtual void ShowImeIfNeeded() = 0; | 35 virtual void ShowImeIfNeeded() = 0; |
| 36 virtual void OnCursorRectChangedWithSurroundingText( |
| 37 const gfx::Rect& rect, |
| 38 const gfx::Range& text_range, |
| 39 const base::string16& text_in_range, |
| 40 const gfx::Range& selection_range) = 0; |
35 }; | 41 }; |
36 | 42 |
37 // Serializes and sends IME related requests through IPCs. | 43 // Serializes and sends IME related requests through IPCs. |
38 virtual void SendSetCompositionText( | 44 virtual void SendSetCompositionText( |
39 const ui::CompositionText& composition) = 0; | 45 const ui::CompositionText& composition) = 0; |
40 virtual void SendConfirmCompositionText() = 0; | 46 virtual void SendConfirmCompositionText() = 0; |
41 virtual void SendInsertText(const base::string16& text) = 0; | 47 virtual void SendInsertText(const base::string16& text) = 0; |
42 virtual void SendOnKeyboardBoundsChanging(const gfx::Rect& new_bounds) = 0; | 48 virtual void SendOnKeyboardBoundsChanging(const gfx::Rect& new_bounds) = 0; |
43 virtual void SendExtendSelectionAndDelete(size_t before, size_t after) = 0; | 49 virtual void SendExtendSelectionAndDelete(size_t before, size_t after) = 0; |
44 | 50 |
45 protected: | 51 protected: |
46 ArcImeBridge() {} | 52 ArcImeBridge() {} |
47 | 53 |
48 private: | 54 private: |
49 DISALLOW_COPY_AND_ASSIGN(ArcImeBridge); | 55 DISALLOW_COPY_AND_ASSIGN(ArcImeBridge); |
50 }; | 56 }; |
51 | 57 |
52 } // namespace arc | 58 } // namespace arc |
53 | 59 |
54 #endif // COMPONENTS_ARC_IME_ARC_IME_BRIDGE_H_ | 60 #endif // COMPONENTS_ARC_IME_ARC_IME_BRIDGE_H_ |
OLD | NEW |