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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/c/dev/ppb_text_input_dev.h
diff --git a/ppapi/c/dev/ppb_text_input_dev.h b/ppapi/c/dev/ppb_text_input_dev.h
index 286ec3457c4a0deb8948e9bc0e0ba62c6d20620f..972dd4b1260cde184c91c4d43e3df4e7e543ee7c 100644
--- a/ppapi/c/dev/ppb_text_input_dev.h
+++ b/ppapi/c/dev/ppb_text_input_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_text_input_dev.idl modified Wed Oct 5 14:06:02 2011. */
+/* From dev/ppb_text_input_dev.idl modified Mon Feb 27 14:16:39 2012. */
#ifndef PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
#define PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
@@ -16,7 +16,8 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_TEXTINPUT_DEV_INTERFACE_0_1 "PPB_TextInput(Dev);0.1"
-#define PPB_TEXTINPUT_DEV_INTERFACE PPB_TEXTINPUT_DEV_INTERFACE_0_1
+#define PPB_TEXTINPUT_DEV_INTERFACE_0_2 "PPB_TextInput(Dev);0.2"
+#define PPB_TEXTINPUT_DEV_INTERFACE PPB_TEXTINPUT_DEV_INTERFACE_0_2
/**
* @file
@@ -66,7 +67,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TextInput_Type, 4);
* to the browser about the text input status of plugins, and functions for
* controlling input method editors (IMEs).
*/
-struct PPB_TextInput_Dev_0_1 {
+struct PPB_TextInput_Dev_0_2 {
/**
* Informs the browser about the current text input mode of the plugin.
* Typical use of this information in the browser is to properly
@@ -87,9 +88,51 @@ struct PPB_TextInput_Dev_0_1 {
* Cancels the current composition in IME.
*/
void (*CancelCompositionText)(PP_Instance instance);
+ /**
+ * In response to the <code>PPP_TextInput_Dev::RequestSurroundingText</code>
+ * call, informs the browser about the current text selection and surrounding
+ * text. <code>text</code> is an UTF-8 string that contains the current range
+ * of text selection in the plugin. <code>caret</code> is the byte-index of
+ * the caret poisition within <code>text</code>. <code>anchor</code> is the
+ * byte-index of the anchor position (i.e., if a range of text is selected,
+ * it is the other edge of selection diffrent from <code>caret</code>. If
+ * there are no selection, <code>anchor</code> is equal to <code>caret</code>.
+ *
+ * Typical use of this information in the browser is to enable "reconversion"
+ * features of IME that puts back the already commited text into the
+ * pre-commit composition state. Another use is to improve the precision
+ * of suggestion of IME by taking the context into account (e.g., if the caret
+ * looks to be on the beggining of a sentense, suggest capital letters in a
+ * virtual keyboard).
+ *
+ * When the focus is not on text, or when the plugin do not want to send the
+ * selection to the browser (e.g., concerning security), call this function
+ * setting <code>text</code> to an empty string and <code>caret</code> and
+ * <code>anchor</code> to zero.
+ */
+ void (*UpdateSurroundingText)(PP_Instance instance,
+ const char* text,
+ uint32_t caret,
+ uint32_t anchor);
+ /**
+ * Informs the browser when a range of text selection is changed in a plugin.
+ * When the browser needs to know the content of the updated selection, it
+ * pings back by <code>PPP_TextInput_Dev::RequestSurroundingText</code>. The
+ * plugin then should send the information with
+ * <code>UpdateSurroundingText</code>.
+ */
+ void (*SelectionChanged)(PP_Instance instance);
};
-typedef struct PPB_TextInput_Dev_0_1 PPB_TextInput_Dev;
+typedef struct PPB_TextInput_Dev_0_2 PPB_TextInput_Dev;
+
+struct PPB_TextInput_Dev_0_1 {
+ void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type);
+ void (*UpdateCaretPosition)(PP_Instance instance,
+ const struct PP_Rect* caret,
+ const struct PP_Rect* bounding_box);
+ void (*CancelCompositionText)(PP_Instance instance);
+};
/**
* @}
*/

Powered by Google App Engine
This is Rietveld 408576698