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

Side by Side Diff: ppapi/c/dev/ppb_text_input_dev.h

Issue 8769003: Pepper IME API for surrounding text retrieval. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sort. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 5
6 /* From dev/ppb_text_input_dev.idl modified Wed Oct 5 14:06:02 2011. */ 6 /* From dev/ppb_text_input_dev.idl modified Mon Feb 27 14:16:39 2012. */
7 7
8 #ifndef PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_ 8 #ifndef PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
9 #define PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_ 9 #define PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
10 10
11 #include "ppapi/c/pp_instance.h" 11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_macros.h" 12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_point.h" 13 #include "ppapi/c/pp_point.h"
14 #include "ppapi/c/pp_rect.h" 14 #include "ppapi/c/pp_rect.h"
15 #include "ppapi/c/pp_size.h" 15 #include "ppapi/c/pp_size.h"
16 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
17 17
18 #define PPB_TEXTINPUT_DEV_INTERFACE_0_1 "PPB_TextInput(Dev);0.1" 18 #define PPB_TEXTINPUT_DEV_INTERFACE_0_1 "PPB_TextInput(Dev);0.1"
19 #define PPB_TEXTINPUT_DEV_INTERFACE PPB_TEXTINPUT_DEV_INTERFACE_0_1 19 #define PPB_TEXTINPUT_DEV_INTERFACE_0_2 "PPB_TextInput(Dev);0.2"
20 #define PPB_TEXTINPUT_DEV_INTERFACE PPB_TEXTINPUT_DEV_INTERFACE_0_2
20 21
21 /** 22 /**
22 * @file 23 * @file
23 * This file defines the <code>PPB_TextInput_Dev</code> interface. 24 * This file defines the <code>PPB_TextInput_Dev</code> interface.
24 */ 25 */
25 26
26 27
27 /** 28 /**
28 * @addtogroup Enums 29 * @addtogroup Enums
29 * @{ 30 * @{
(...skipping 29 matching lines...) Expand all
59 60
60 /** 61 /**
61 * @addtogroup Interfaces 62 * @addtogroup Interfaces
62 * @{ 63 * @{
63 */ 64 */
64 /** 65 /**
65 * <code>PPB_TextInput_Dev</code> provides a set of functions for giving hints 66 * <code>PPB_TextInput_Dev</code> provides a set of functions for giving hints
66 * to the browser about the text input status of plugins, and functions for 67 * to the browser about the text input status of plugins, and functions for
67 * controlling input method editors (IMEs). 68 * controlling input method editors (IMEs).
68 */ 69 */
69 struct PPB_TextInput_Dev_0_1 { 70 struct PPB_TextInput_Dev_0_2 {
70 /** 71 /**
71 * Informs the browser about the current text input mode of the plugin. 72 * Informs the browser about the current text input mode of the plugin.
72 * Typical use of this information in the browser is to properly 73 * Typical use of this information in the browser is to properly
73 * display/suppress tools for supporting text inputs (such as virtual 74 * display/suppress tools for supporting text inputs (such as virtual
74 * keyboards in touch screen based devices, or input method editors often 75 * keyboards in touch screen based devices, or input method editors often
75 * used for composing East Asian characters). 76 * used for composing East Asian characters).
76 */ 77 */
77 void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type); 78 void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type);
78 /** 79 /**
79 * Informs the browser about the coordinates of the text input caret and the 80 * Informs the browser about the coordinates of the text input caret and the
80 * bounding box of the text input area. Typical use of this information in 81 * bounding box of the text input area. Typical use of this information in
81 * the browser is to layout IME windows etc. 82 * the browser is to layout IME windows etc.
82 */ 83 */
83 void (*UpdateCaretPosition)(PP_Instance instance, 84 void (*UpdateCaretPosition)(PP_Instance instance,
84 const struct PP_Rect* caret, 85 const struct PP_Rect* caret,
85 const struct PP_Rect* bounding_box); 86 const struct PP_Rect* bounding_box);
86 /** 87 /**
87 * Cancels the current composition in IME. 88 * Cancels the current composition in IME.
88 */ 89 */
89 void (*CancelCompositionText)(PP_Instance instance); 90 void (*CancelCompositionText)(PP_Instance instance);
91 /**
92 * In response to the <code>PPP_TextInput_Dev::RequestSurroundingText</code>
93 * call, informs the browser about the current text selection and surrounding
94 * text. <code>text</code> is an UTF-8 string that contains the current range
95 * of text selection in the plugin. <code>caret</code> is the byte-index of
96 * the caret poisition within <code>text</code>. <code>anchor</code> is the
97 * byte-index of the anchor position (i.e., if a range of text is selected,
98 * it is the other edge of selection diffrent from <code>caret</code>. If
99 * there are no selection, <code>anchor</code> is equal to <code>caret</code>.
100 *
101 * Typical use of this information in the browser is to enable "reconversion"
102 * features of IME that puts back the already commited text into the
103 * pre-commit composition state. Another use is to improve the precision
104 * of suggestion of IME by taking the context into account (e.g., if the caret
105 * looks to be on the beggining of a sentense, suggest capital letters in a
106 * virtual keyboard).
107 *
108 * When the focus is not on text, or when the plugin do not want to send the
109 * selection to the browser (e.g., concerning security), call this function
110 * setting <code>text</code> to an empty string and <code>caret</code> and
111 * <code>anchor</code> to zero.
112 */
113 void (*UpdateSurroundingText)(PP_Instance instance,
114 const char* text,
115 uint32_t caret,
116 uint32_t anchor);
117 /**
118 * Informs the browser when a range of text selection is changed in a plugin.
119 * When the browser needs to know the content of the updated selection, it
120 * pings back by <code>PPP_TextInput_Dev::RequestSurroundingText</code>. The
121 * plugin then should send the information with
122 * <code>UpdateSurroundingText</code>.
123 */
124 void (*SelectionChanged)(PP_Instance instance);
90 }; 125 };
91 126
92 typedef struct PPB_TextInput_Dev_0_1 PPB_TextInput_Dev; 127 typedef struct PPB_TextInput_Dev_0_2 PPB_TextInput_Dev;
128
129 struct PPB_TextInput_Dev_0_1 {
130 void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type);
131 void (*UpdateCaretPosition)(PP_Instance instance,
132 const struct PP_Rect* caret,
133 const struct PP_Rect* bounding_box);
134 void (*CancelCompositionText)(PP_Instance instance);
135 };
93 /** 136 /**
94 * @} 137 * @}
95 */ 138 */
96 139
97 #endif /* PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_ */ 140 #endif /* PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_ */
98 141
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698