Chromium Code Reviews| 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 module ui.mojom; | 5 module ui.mojom; |
| 6 | 6 |
| 7 import "ui/events/mojo/event.mojom"; | 7 import "ui/events/mojo/event.mojom"; |
| 8 import "ui/gfx/geometry/mojo/geometry.mojom"; | 8 import "ui/gfx/geometry/mojo/geometry.mojom"; |
| 9 import "ui/gfx/range/mojo/range.mojom"; | |
| 9 | 10 |
| 10 struct CompositionEvent { | 11 // Represents an underlined segment of text currently composed by IME. |
| 11 CompositionEventType type; | 12 // Corresponds to ui::CompositionUnderline. |
| 12 | 13 struct CompositionUnderline { |
| 13 // Used when |type| is INSERT_CHAR. See the comments for | 14 uint32 start_offset; |
| 14 // ui::TextInputClient::InsertChar() for more information. | 15 uint32 end_offset; |
| 15 Event? key_event; | 16 bool thick; |
| 16 | 17 uint32 color; |
| 17 // TODO(moshayedi): crbug.com/631524. Add fields required for other types of | 18 uint32 background_color; |
| 18 // composition event. | |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 enum CompositionEventType { | 21 // Represents a text currently being composed by IME. Corresponds to |
| 22 UPDATE, | 22 // ui::CompositionText. |
| 23 CONFIRM, | 23 struct CompositionText { |
| 24 CLEAR, | 24 string text; |
| 25 INSERT_CHAR, | 25 array<CompositionUnderline> underlines; |
| 26 INSERT_TEXT | 26 gfx.mojom.Range selection; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // See comments for ui::TextInputType for more details. | 29 // See comments for ui::TextInputType for more details. |
| 30 enum TextInputType { | 30 enum TextInputType { |
| 31 NONE, | 31 NONE, |
| 32 TEXT, | 32 TEXT, |
| 33 PASSWORD, | 33 PASSWORD, |
| 34 SEARCH, | 34 SEARCH, |
| 35 EMAIL, | 35 EMAIL, |
| 36 NUMBER, | 36 NUMBER, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 OnTextInputModeChanged(TextInputMode text_input_mode); | 89 OnTextInputModeChanged(TextInputMode text_input_mode); |
| 90 OnTextInputTypeChanged(TextInputType text_input_type); | 90 OnTextInputTypeChanged(TextInputType text_input_type); |
| 91 | 91 |
| 92 // Client sends |caret_bounds| in focused window coordinates, | 92 // Client sends |caret_bounds| in focused window coordinates, |
| 93 // Mus translates it to global coordinates and sends it to IME app. | 93 // Mus translates it to global coordinates and sends it to IME app. |
| 94 OnCaretBoundsChanged(gfx.mojom.Rect caret_bounds); | 94 OnCaretBoundsChanged(gfx.mojom.Rect caret_bounds); |
| 95 | 95 |
| 96 // Called to process a key event. The callback function will be called to | 96 // Called to process a key event. The callback function will be called to |
| 97 // notify the client if the event was handled or not. A handled event may | 97 // notify the client if the event was handled or not. A handled event may |
| 98 // generate zero or more composition events which will be sent to the client | 98 // generate zero or more composition events which will be sent to the client |
| 99 // by calling TextInputClient::OnCompositionEvent(). | 99 // using the "input method result" functions of TextInputClient interface. |
| 100 ProcessKeyEvent(ui.mojom.Event key_event) => (bool handled); | 100 ProcessKeyEvent(ui.mojom.Event key_event) => (bool handled); |
| 101 | 101 |
| 102 CancelComposition(); | 102 CancelComposition(); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 // IME drivers send updates to clients using the TextInputClient interface. | 105 // IME drivers send updates to clients using the TextInputClient interface. |
| 106 interface TextInputClient { | 106 interface TextInputClient { |
| 107 // Corresponds to "input method result" functions of ui::TextInputClient. | 107 // Functions corresponding to "input method result" functions of |
| 108 // See comments for InputMethod::ProcessKeyEvent() for when this is called. | 108 // ui::TextInputClient. See comments for InputMethod::ProcessKeyEvent() for |
| 109 OnCompositionEvent(CompositionEvent event); | 109 // when these are called. |
| 110 SetCompositionText(CompositionText composition); | |
| 111 ConfirmCompositionText(); | |
| 112 ClearCompositionText(); | |
| 113 InsertText(string text); | |
| 114 InsertChar(ui.mojom.Event event); | |
| 110 | 115 |
| 111 // TODO(moshayedi): Add functions corresponding to ui::TextInputClient for: | 116 // TODO(moshayedi): Add functions corresponding to ui::TextInputClient for: |
| 112 // - Input text confirmation | 117 // - Input text confirmation |
| 113 // - Document content operations | 118 // - Document content operations |
| 114 // - Miscellaneous functions | 119 // - Miscellaneous functions |
| 115 // crbug.com/631527. | 120 // crbug.com/631527. |
|
sadrul
2016/11/29 20:51:35
Should this TODO be updated?
Hadi
2016/11/29 21:33:37
"Input text confirmation" should have been "Input
| |
| 116 }; | 121 }; |
| OLD | NEW |