blob: 36ee7d56590871962680f75d82fefff960f5cb0b [file] [log] [blame]
[email protected]79cad342013-08-01 00:22:481/* Copyright 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6/**
7 * This file defines the <code>PPB_TextInputController</code> interface.
8 */
9
10label Chrome {
11 M30 = 1.0
12};
13
14/**
15 * PP_TextInput_Type is used to indicate the status of a plugin in regard to
16 * text input.
17 */
18[assert_size(4)]
19enum PP_TextInput_Type {
20 /**
21 * Input caret is not in an editable mode, no input method shall be used.
22 */
23 PP_TEXTINPUT_TYPE_NONE = 0,
24 /**
25 * Input caret is in a normal editable mode, any input method can be used.
26 */
27 PP_TEXTINPUT_TYPE_TEXT = 1,
28 /**
29 * Input caret is in a password box, an input method may be used only if
30 * it's suitable for password input.
31 */
32 PP_TEXTINPUT_TYPE_PASSWORD = 2,
33 PP_TEXTINPUT_TYPE_SEARCH = 3,
34 PP_TEXTINPUT_TYPE_EMAIL = 4,
35 PP_TEXTINPUT_TYPE_NUMBER = 5,
36 PP_TEXTINPUT_TYPE_TELEPHONE = 6,
Rob Buis1fc16ae2017-11-08 20:38:1037 PP_TEXTINPUT_TYPE_URL = 7,
38 PP_TEXTINPUT_TYPE_LAST = PP_TEXTINPUT_TYPE_URL
[email protected]79cad342013-08-01 00:22:4839};
40
41/**
42 * <code>PPB_TextInputController</code> provides a set of functions for giving
43 * hints to the browser about the text input status of plugins, and functions
44 * for controlling input method editors (IMEs).
45 */
46interface PPB_TextInputController {
47 /**
48 * Informs the browser about the current text input mode of the plugin.
49 * Typical use of this information in the browser is to properly
50 * display/suppress tools for supporting text inputs (such as virtual
51 * keyboards in touch screen based devices, or input method editors often
52 * used for composing East Asian characters).
53 */
54 void SetTextInputType([in] PP_Instance instance,
55 [in] PP_TextInput_Type type);
56
57 /**
58 * Informs the browser about the coordinates of the text input caret area.
59 * Typical use of this information in the browser is to layout IME windows
60 * etc.
61 */
62 void UpdateCaretPosition([in] PP_Instance instance,
63 [in] PP_Rect caret);
64
65 /**
66 * Cancels the current composition in IME.
67 */
68 void CancelCompositionText([in] PP_Instance instance);
69
70 /**
71 * Informs the browser about the current text selection and surrounding
72 * text. <code>text</code> is a UTF-8 string that contains the current range
73 * of text selection in the plugin. <code>caret</code> is the byte-index of
74 * the caret position within <code>text</code>. <code>anchor</code> is the
75 * byte-index of the anchor position (i.e., if a range of text is selected,
76 * it is the other edge of selection different from <code>caret</code>. If
77 * there are no selection, <code>anchor</code> is equal to <code>caret</code>.
78 *
79 * Typical use of this information in the browser is to enable "reconversion"
80 * features of IME that puts back the already committed text into the
81 * pre-commit composition state. Another use is to improve the precision
82 * of suggestion of IME by taking the context into account (e.g., if the caret
83 * looks to be on the beginning of a sentence, suggest capital letters in a
84 * virtual keyboard).
85 *
86 * When the focus is not on text, call this function setting <code>text</code>
87 * to an empty string and <code>caret</code> and <code>anchor</code> to zero.
88 * Also, the plugin should send the empty text when it does not want to reveal
89 * the selection to IME (e.g., when the surrounding text is containing
90 * password text).
91 */
92 void UpdateSurroundingText([in] PP_Instance instance,
93 [in] PP_Var text,
94 [in] uint32_t caret,
95 [in] uint32_t anchor);
96};