Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: components/arc/common/ime.mojom

Issue 2876693004: Implement GetTextFromRange(), GetTextRange() and GetSelectionRange() for ArcImeService. (Closed)
Patch Set: use typemapping Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Represents the range in the text. It is an open interval [start, end).
36 [MinVersion=5]
37 struct TextRange {
38 // Start offset in UTF-16 index.
39 uint32 start;
40 // End offset in UTF-16 index.
41 uint32 end;
42 };
43
35 // Represents a single segment of text currently composed by IME. 44 // Represents a single segment of text currently composed by IME.
36 struct CompositionSegment { 45 struct CompositionSegment {
37 // Start offset of the segment in UTF-16 index. 46 // Start offset of the segment in UTF-16 index.
38 uint32 start_offset; 47 uint32 start_offset;
39 // End offset of the segment in UTF-16 index. 48 // End offset of the segment in UTF-16 index.
40 uint32 end_offset; 49 uint32 end_offset;
41 // Indicates that this segment should be emphasized. 50 // Indicates that this segment should be emphasized.
42 bool emphasized; 51 bool emphasized;
43 }; 52 };
44 53
45 // Next method ID: 4 54 // Next method ID: 4
46 interface ImeHost { 55 interface ImeHost {
47 // Notifies Chrome that the text input focus is changed. 56 // Notifies Chrome that the text input focus is changed.
48 OnTextInputTypeChanged@0(TextInputType type); 57 OnTextInputTypeChanged@0(TextInputType type);
49 58
50 // Notifies Chrome that the cursor poisition has changed. 59 // Notifies Chrome that the cursor poisition has changed.
51 OnCursorRectChanged@1(CursorRect rect); 60 OnCursorRectChanged@1(CursorRect rect);
52 61
53 // Notifies Chrome that the current composition is canceled. 62 // Notifies Chrome that the current composition is canceled.
54 [MinVersion=1] OnCancelComposition@2(); 63 [MinVersion=1] OnCancelComposition@2();
55 64
56 // Show virtual keyboard of Chrome OS if needed. 65 // Show virtual keyboard of Chrome OS if needed.
57 [MinVersion=2] ShowImeIfNeeded@3(); 66 [MinVersion=2] ShowImeIfNeeded@3();
67
68 // Notifies Chrome that the cursor position has changed and
69 // also sends surrounding text.
70 //
71 // |text_range|, |text_in_range| and |selection_range| are piggy-backed
72 // into this method because Chrome OS IME tries to retrieve these information
73 // synchronously, so we need to update them all at once to keep consistency.
74 [MinVersion=5] OnCursorRectChangedWithSurroundingText@4(
75 CursorRect rect, // The cursor position.
hidehiko 2017/05/16 10:08:59 Optional: How about using Rect in ui/gfx/geometry/
76 TextRange text_range, // The range of |text_in_range| in the current
hidehiko 2017/05/16 10:08:59 Ditto, for ui/gfx/range/mojo/range.mojom.
77 // text in the editor.
78 string text_in_range, // The text around the cursor.
79 TextRange selection_range // The range of the selected text
80 // in the current text in the editor.
81 );
58 }; 82 };
59 83
60 // Next method ID: 6 84 // Next method ID: 6
61 interface ImeInstance { 85 interface ImeInstance {
62 Init@0(ImeHost host_ptr); 86 Init@0(ImeHost host_ptr);
63 87
64 // Sets composition text and attributes requested by the host IME. 88 // Sets composition text and attributes requested by the host IME.
65 SetCompositionText@1(string text, array<CompositionSegment> segments); 89 SetCompositionText@1(string text, array<CompositionSegment> segments);
66 90
67 // Commits the last set composition text and clears the composition. 91 // Commits the last set composition text and clears the composition.
68 ConfirmCompositionText@2(); 92 ConfirmCompositionText@2();
69 93
70 // Commits the specified text and clears the composition. 94 // Commits the specified text and clears the composition.
71 InsertText@3(string text); 95 InsertText@3(string text);
72 96
73 // Informs the virtual keyboard bounds on screen is changing. 97 // Informs the virtual keyboard bounds on screen is changing.
74 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS 98 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS
75 // screen coordinate, physical pixel as a unit. 99 // screen coordinate, physical pixel as a unit.
76 // When all members are zero value, virtual keyboard is being hidden. 100 // When all members are zero value, virtual keyboard is being hidden.
77 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); 101 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds);
78 102
79 // Deletes current selection plus the specified number of char16 values 103 // Deletes current selection plus the specified number of char16 values
80 // before and after selection or caret. 104 // before and after selection or caret.
81 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); 105 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after);
82 }; 106 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698