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 // Next MinVersion: 5 | 5 // Next MinVersion: 6 |
6 | 6 |
7 module arc.mojom; | 7 module arc.mojom; |
8 | 8 |
9 import "screen_rect.mojom"; | 9 import "screen_rect.mojom"; |
10 | 10 |
11 // Represents the type of text input field currently focused. | 11 // Represents the type of text input field currently focused. |
12 [Extensible] | 12 [Extensible] |
13 enum TextInputType { | 13 enum TextInputType { |
14 NONE, | 14 NONE, |
15 TEXT, | 15 TEXT, |
16 PASSWORD, | 16 PASSWORD, |
17 SEARCH, | 17 SEARCH, |
18 EMAIL, | 18 EMAIL, |
19 NUMBER, | 19 NUMBER, |
20 TELEPHONE, | 20 TELEPHONE, |
21 URL, | 21 URL, |
22 DATE, | 22 DATE, |
23 TIME, | 23 TIME, |
24 DATETIME, | 24 DATETIME, |
25 }; | 25 }; |
26 | 26 |
| 27 // TODO(yhanada): Switch to use gfx.mojom.Rect. See crbug.com/723224. |
27 // Represents the text insertion points in the container screen coordinates. | 28 // Represents the text insertion points in the container screen coordinates. |
28 struct CursorRect { | 29 struct CursorRect { |
29 int32 left; | 30 int32 left; |
30 int32 top; | 31 int32 top; |
31 int32 right; | 32 int32 right; |
32 int32 bottom; | 33 int32 bottom; |
33 }; | 34 }; |
34 | 35 |
| 36 // TODO(yhanada): Switch to use gfx.mojom.Range. See crbug.com/723224. |
| 37 // Represents the range in the text. It is an open interval [start, end). |
| 38 [MinVersion=5] |
| 39 struct TextRange { |
| 40 // Start offset in UTF-16 index. |
| 41 uint32 start; |
| 42 // End offset in UTF-16 index. |
| 43 uint32 end; |
| 44 }; |
| 45 |
35 // Represents a single segment of text currently composed by IME. | 46 // Represents a single segment of text currently composed by IME. |
36 struct CompositionSegment { | 47 struct CompositionSegment { |
37 // Start offset of the segment in UTF-16 index. | 48 // Start offset of the segment in UTF-16 index. |
38 uint32 start_offset; | 49 uint32 start_offset; |
39 // End offset of the segment in UTF-16 index. | 50 // End offset of the segment in UTF-16 index. |
40 uint32 end_offset; | 51 uint32 end_offset; |
41 // Indicates that this segment should be emphasized. | 52 // Indicates that this segment should be emphasized. |
42 bool emphasized; | 53 bool emphasized; |
43 }; | 54 }; |
44 | 55 |
45 // Next method ID: 4 | 56 // Next method ID: 4 |
46 interface ImeHost { | 57 interface ImeHost { |
47 // Notifies Chrome that the text input focus is changed. | 58 // Notifies Chrome that the text input focus is changed. |
48 OnTextInputTypeChanged@0(TextInputType type); | 59 OnTextInputTypeChanged@0(TextInputType type); |
49 | 60 |
50 // Notifies Chrome that the cursor poisition has changed. | 61 // Notifies Chrome that the cursor poisition has changed. |
51 OnCursorRectChanged@1(CursorRect rect); | 62 OnCursorRectChanged@1(CursorRect rect); |
52 | 63 |
53 // Notifies Chrome that the current composition is canceled. | 64 // Notifies Chrome that the current composition is canceled. |
54 [MinVersion=1] OnCancelComposition@2(); | 65 [MinVersion=1] OnCancelComposition@2(); |
55 | 66 |
56 // Show virtual keyboard of Chrome OS if needed. | 67 // Show virtual keyboard of Chrome OS if needed. |
57 [MinVersion=2] ShowImeIfNeeded@3(); | 68 [MinVersion=2] ShowImeIfNeeded@3(); |
| 69 |
| 70 // Notifies Chrome that the cursor position has changed and |
| 71 // also sends surrounding text. |
| 72 // |
| 73 // |text_range|, |text_in_range| and |selection_range| are piggy-backed |
| 74 // into this method because Chrome OS IME tries to retrieve these information |
| 75 // synchronously, so we need to update them all at once to keep consistency. |
| 76 [MinVersion=5] OnCursorRectChangedWithSurroundingText@4( |
| 77 CursorRect rect, // The cursor position. |
| 78 TextRange text_range, // The range of |text_in_range| in the current |
| 79 // text in the editor. |
| 80 string text_in_range, // The text around the cursor. |
| 81 TextRange selection_range // The range of the selected text |
| 82 // in the current text in the editor. |
| 83 ); |
58 }; | 84 }; |
59 | 85 |
60 // Next method ID: 6 | 86 // Next method ID: 6 |
61 interface ImeInstance { | 87 interface ImeInstance { |
62 Init@0(ImeHost host_ptr); | 88 Init@0(ImeHost host_ptr); |
63 | 89 |
64 // Sets composition text and attributes requested by the host IME. | 90 // Sets composition text and attributes requested by the host IME. |
65 SetCompositionText@1(string text, array<CompositionSegment> segments); | 91 SetCompositionText@1(string text, array<CompositionSegment> segments); |
66 | 92 |
67 // Commits the last set composition text and clears the composition. | 93 // Commits the last set composition text and clears the composition. |
68 ConfirmCompositionText@2(); | 94 ConfirmCompositionText@2(); |
69 | 95 |
70 // Commits the specified text and clears the composition. | 96 // Commits the specified text and clears the composition. |
71 InsertText@3(string text); | 97 InsertText@3(string text); |
72 | 98 |
73 // Informs the virtual keyboard bounds on screen is changing. | 99 // Informs the virtual keyboard bounds on screen is changing. |
74 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS | 100 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS |
75 // screen coordinate, physical pixel as a unit. | 101 // screen coordinate, physical pixel as a unit. |
76 // When all members are zero value, virtual keyboard is being hidden. | 102 // When all members are zero value, virtual keyboard is being hidden. |
77 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); | 103 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); |
78 | 104 |
79 // Deletes current selection plus the specified number of char16 values | 105 // Deletes current selection plus the specified number of char16 values |
80 // before and after selection or caret. | 106 // before and after selection or caret. |
81 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); | 107 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); |
82 }; | 108 }; |
OLD | NEW |