summaryrefslogtreecommitdiffstats
path: root/ppapi/c
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 05:27:49 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-16 05:27:49 +0000
commitcb656de64b8e198c1685fa3bd2990f4d50977a03 (patch)
tree7291276f34be9861462aa452fcd98d39a053c590 /ppapi/c
parentbd9d89195617ab132fe61171bdd93a3ab949ae35 (diff)
downloadchromium_src-cb656de64b8e198c1685fa3bd2990f4d50977a03.zip
chromium_src-cb656de64b8e198c1685fa3bd2990f4d50977a03.tar.gz
chromium_src-cb656de64b8e198c1685fa3bd2990f4d50977a03.tar.bz2
Declarations for Pepper IME API.
BUG=59425 TEST=Check that ppapi_tests compile. This change list is the first part for adding IME support for PPAPI. For effectiveness of reviewing, I'll split the rather large change into three parts: (*1) Header files declaring IME API. (2) Boilerplate code for proxy & thunk stuff. (3) Actual implementation in webkit/plugin/ppapi/* and content/renderer/*. Review URL: http://codereview.chromium.org/7882004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r--ppapi/c/dev/ppb_ime_input_event_dev.h114
-rw-r--r--ppapi/c/dev/ppb_text_input_dev.h100
-rw-r--r--ppapi/c/ppb_input_event.h28
3 files changed, 240 insertions, 2 deletions
diff --git a/ppapi/c/dev/ppb_ime_input_event_dev.h b/ppapi/c/dev/ppb_ime_input_event_dev.h
new file mode 100644
index 0000000..0131632
--- /dev/null
+++ b/ppapi/c/dev/ppb_ime_input_event_dev.h
@@ -0,0 +1,114 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From dev/ppb_ime_input_event_dev.idl modified Thu Sep 15 17:06:09 2011. */
+
+#ifndef PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_
+#define PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1 "PPB_IMEInputEvent(Dev);0.1"
+#define PPB_IME_INPUT_EVENT_DEV_INTERFACE PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_IMEInputEvent_Dev</code> interface.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_IMEInputEvent_Dev {
+ /**
+ * IsIMEInputEvent() determines if a resource is an IME event.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to an event.
+ *
+ * @return <code>PP_TRUE</code> if the given resource is a valid input event.
+ */
+ PP_Bool (*IsIMEInputEvent)(PP_Resource resource);
+ /**
+ * GetText() returns the composition text as a UTF-8 string for the given IME
+ * event.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @return A string var representing the composition text. For non-IME input
+ * events the return value will be an undefined var.
+ */
+ struct PP_Var (*GetText)(PP_Resource ime_event);
+ /**
+ * GetSegmentNumber() returns the number of segments in the composition text.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @return The number of segments. For events other than COMPOSITION_UPDATE,
+ * returns 0.
+ */
+ uint32_t (*GetSegmentNumber)(PP_Resource ime_event);
+ /**
+ * GetSegmentAt() returns the start and the end position of the index-th
+ * segment in the composition text. The positions are given by byte-offsets
+ * (not character-offsets) of the string returned by GetText(). The range of
+ * the segment extends from start (inclusive) to end (exclusive). They satisfy
+ * 0 <= start < end <= (byte-length of GetText()). When the event is not
+ * COMPOSITION_UPDATE or index >= GetSegmentNumber(), the function returns
+ * PP_FALSE and nothing else happens.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @param[in] index An integer indicating a segment.
+ *
+ * @param[out] start The start position of the index-th segment.
+ *
+ * @param[out] end The end position of the index-th segment.
+ *
+ * @return PP_TRUE when the start and the end position is successfully
+ * obtained, and PP_FALSE otherwise.
+ */
+ PP_Bool (*GetSegmentAt)(PP_Resource ime_event,
+ uint32_t index,
+ uint32_t* start,
+ uint32_t* end);
+ /**
+ * GetTargetSegment() returns the index of the current target segment of
+ * composition.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @return An integer indicating the index of the target segment. When there
+ * is no active target segment, or the event is not COMPOSITION_UPDATE,
+ * returns -1.
+ */
+ int32_t (*GetTargetSegment)(PP_Resource ime_event);
+ /**
+ * GetSelection() returns the range selected by caret in the composition text.
+ *
+ * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ * event.
+ *
+ * @param[out] start The start position of the current selection.
+ *
+ * @param[out] end The end position of the current selection.
+ */
+ void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end);
+};
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_text_input_dev.h b/ppapi/c/dev/ppb_text_input_dev.h
new file mode 100644
index 0000000..51c990e
--- /dev/null
+++ b/ppapi/c/dev/ppb_text_input_dev.h
@@ -0,0 +1,100 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From dev/ppb_text_input_dev.idl modified Wed Sep 14 12:51:46 2011. */
+
+#ifndef PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
+#define PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_size.h"
+#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
+
+/**
+ * @file
+ * This file defines the <code>PPB_TextInput_Dev</code> interface.
+ */
+
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
+/**
+ * PP_TextInput_Type is used to indicate the status of a plugin in regard to
+ * text input.
+ */
+typedef enum {
+ /**
+ * Input caret is not in an editable mode, no input method shall be used.
+ */
+ PP_TEXTINPUT_TYPE_NONE = 0,
+ /**
+ * Input caret is in a normal editable mode, any input method can be used.
+ */
+ PP_TEXTINPUT_TYPE_TEXT = 1,
+ /**
+ * Input caret is in a password box, an input method may be used only if
+ * it's suitable for password input.
+ */
+ PP_TEXTINPUT_TYPE_PASSWORD = 2,
+ PP_TEXTINPUT_TYPE_SEARCH = 3,
+ PP_TEXTINPUT_TYPE_EMAIL = 4,
+ PP_TEXTINPUT_TYPE_NUMBER = 5,
+ PP_TEXTINPUT_TYPE_TELEPHONE = 6,
+ PP_TEXTINPUT_TYPE_URL = 7
+} PP_TextInput_Type;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TextInput_Type, 4);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * <code>PPB_TextInput_Dev</code> provides a set of functions for giving hints
+ * to the browser about the text input status of plugins, and functions for
+ * controlling input method editors (IMEs).
+ */
+struct PPB_TextInput_Dev {
+ /**
+ * Informs the browser about the current text input mode of the plugin.
+ * Typical use of this information in the browser is to properly
+ * display/suppress tools for supporting text inputs (such as virtual
+ * keyboards in touch screen based devices, or input method editors often
+ * used for composing East Asian characters).
+ */
+ void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type);
+ /**
+ * Informs the browser about the coordinates of the text input caret and the
+ * bounding box of the text input area. Typical use of this information in
+ * the browser is to layout IME windows etc.
+ */
+ void (*UpdateCaretPosition)(PP_Instance instance,
+ const struct PP_Rect* caret,
+ const struct PP_Rect* bounding_box);
+ /**
+ * Forces to commit the current composition text in IME.
+ */
+ void (*ConfirmCompositionText)(PP_Instance instance);
+ /**
+ * Cancels the current composition in IME.
+ */
+ void (*CancelCompositionText)(PP_Instance instance);
+};
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_ */
+
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index 8a73279..21b7c12 100644
--- a/ppapi/c/ppb_input_event.h
+++ b/ppapi/c/ppb_input_event.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_input_event.idl modified Wed Aug 24 09:43:38 2011. */
+/* From ppb_input_event.idl modified Wed Sep 14 12:46:14 2011. */
#ifndef PPAPI_C_PPB_INPUT_EVENT_H_
#define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -117,7 +117,31 @@ typedef enum {
*
* Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
*/
- PP_INPUTEVENT_TYPE_CONTEXTMENU = 10
+ PP_INPUTEVENT_TYPE_CONTEXTMENU = 10,
+ /**
+ * Notification that an input method composition process has just started.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_IME class.
+ */
+ PP_INPUTEVENT_TYPE_COMPOSITION_START = 11,
+ /**
+ * Notification that the input method composition string is updated.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_IME class.
+ */
+ PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE = 12,
+ /**
+ * Notification that an input method composition process has completed.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_IME class.
+ */
+ PP_INPUTEVENT_TYPE_COMPOSITION_END = 13,
+ /**
+ * Notification that an input method committed a string.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_IME class.
+ */
+ PP_INPUTEVENT_TYPE_IME_TEXT = 14
} PP_InputEvent_Type;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4);