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 // Represents the text insertion points in the container screen coordinates. | 27 // Represents the text insertion points in the container screen coordinates. |
28 struct CursorRect { | 28 struct CursorRect { |
29 int32 left; | 29 int32 left; |
30 int32 top; | 30 int32 top; |
31 int32 right; | 31 int32 right; |
32 int32 bottom; | 32 int32 bottom; |
33 }; | 33 }; |
34 | 34 |
35 [MinVersion=5] | |
36 struct TextRange { | |
37 uint32 start; | |
38 uint32 end; | |
hidehiko
2017/05/11 14:32:31
Is |end| inclusive or exclusive? As this is interf
yhanada
2017/05/12 07:52:06
Done.
| |
39 }; | |
40 | |
35 // Represents a single segment of text currently composed by IME. | 41 // Represents a single segment of text currently composed by IME. |
36 struct CompositionSegment { | 42 struct CompositionSegment { |
37 // Start offset of the segment in UTF-16 index. | 43 // Start offset of the segment in UTF-16 index. |
38 uint32 start_offset; | 44 uint32 start_offset; |
39 // End offset of the segment in UTF-16 index. | 45 // End offset of the segment in UTF-16 index. |
40 uint32 end_offset; | 46 uint32 end_offset; |
41 // Indicates that this segment should be emphasized. | 47 // Indicates that this segment should be emphasized. |
42 bool emphasized; | 48 bool emphasized; |
43 }; | 49 }; |
44 | 50 |
45 // Next method ID: 4 | 51 // Next method ID: 4 |
46 interface ImeHost { | 52 interface ImeHost { |
47 // Notifies Chrome that the text input focus is changed. | 53 // Notifies Chrome that the text input focus is changed. |
48 OnTextInputTypeChanged@0(TextInputType type); | 54 OnTextInputTypeChanged@0(TextInputType type); |
49 | 55 |
50 // Notifies Chrome that the cursor poisition has changed. | 56 // Notifies Chrome that the cursor poisition has changed. |
51 OnCursorRectChanged@1(CursorRect rect); | 57 OnCursorRectChanged@1(CursorRect rect); |
kinaba
2017/05/12 01:28:35
Will this still be used or is left for backward co
yhanada
2017/05/12 07:52:06
This will be used when failing to get the text and
| |
52 | 58 |
53 // Notifies Chrome that the current composition is canceled. | 59 // Notifies Chrome that the current composition is canceled. |
54 [MinVersion=1] OnCancelComposition@2(); | 60 [MinVersion=1] OnCancelComposition@2(); |
55 | 61 |
56 // Show virtual keyboard of Chrome OS if needed. | 62 // Show virtual keyboard of Chrome OS if needed. |
57 [MinVersion=2] ShowImeIfNeeded@3(); | 63 [MinVersion=2] ShowImeIfNeeded@3(); |
64 | |
65 // Notifies Chrome that the cursor position has changed and | |
66 // also sends surrounding text. | |
67 [MinVersion=5] OnCursorRectChangedWithSurroundingText@4( | |
hidehiko
2017/05/11 14:32:31
Could you document the args? Specifically what is
kinaba
2017/05/12 01:28:35
Could you also add a comment why all these info ar
yhanada
2017/05/12 07:52:06
Done.
| |
68 CursorRect rect, TextRange text_range, string text_in_range, | |
69 TextRange selection_range); | |
58 }; | 70 }; |
59 | 71 |
60 // Next method ID: 6 | 72 // Next method ID: 6 |
61 interface ImeInstance { | 73 interface ImeInstance { |
62 Init@0(ImeHost host_ptr); | 74 Init@0(ImeHost host_ptr); |
63 | 75 |
64 // Sets composition text and attributes requested by the host IME. | 76 // Sets composition text and attributes requested by the host IME. |
65 SetCompositionText@1(string text, array<CompositionSegment> segments); | 77 SetCompositionText@1(string text, array<CompositionSegment> segments); |
66 | 78 |
67 // Commits the last set composition text and clears the composition. | 79 // Commits the last set composition text and clears the composition. |
68 ConfirmCompositionText@2(); | 80 ConfirmCompositionText@2(); |
69 | 81 |
70 // Commits the specified text and clears the composition. | 82 // Commits the specified text and clears the composition. |
71 InsertText@3(string text); | 83 InsertText@3(string text); |
72 | 84 |
73 // Informs the virtual keyboard bounds on screen is changing. | 85 // Informs the virtual keyboard bounds on screen is changing. |
74 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS | 86 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS |
75 // screen coordinate, physical pixel as a unit. | 87 // screen coordinate, physical pixel as a unit. |
76 // When all members are zero value, virtual keyboard is being hidden. | 88 // When all members are zero value, virtual keyboard is being hidden. |
77 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); | 89 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); |
78 | 90 |
79 // Deletes current selection plus the specified number of char16 values | 91 // Deletes current selection plus the specified number of char16 values |
80 // before and after selection or caret. | 92 // before and after selection or caret. |
81 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); | 93 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); |
82 }; | 94 }; |
OLD | NEW |