summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 04:23:09 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 04:23:09 +0000
commit2daba2f3623744b78f1880d8ebb0a673d03f52d3 (patch)
tree5bdad577cacfe4147ffceddcb1b1d0e1b6955232
parent47d09f6e03e6d8ee179e479095c5afd9564921e0 (diff)
downloadchromium_src-2daba2f3623744b78f1880d8ebb0a673d03f52d3.zip
chromium_src-2daba2f3623744b78f1880d8ebb0a673d03f52d3.tar.gz
chromium_src-2daba2f3623744b78f1880d8ebb0a673d03f52d3.tar.bz2
Additional update on Pepper IME API and boilerplate thunk/proxy implementation.
BUG=59425 TEST=Check that ppapi_tests compile (with GYP_DEFINES=shared_library, too). This CL is the second (out of three) part for adding IME support for PPAPI. It reflects comments from James Su to the previous CL: http://codereview.chromium.org/7882004. - Renamed ..._COMPOSTION_START to _IME_COMPOSITON_START. - Changed to assure GetSegment to return a strictly increasing sequence of segmentation points from 0 to the length. and, - Added the mostly boilerplate code for interfacing with in-process & out-of-process plugins. The actual implementation of the IME support will come as the next and the last part of this series of patches. Review URL: http://codereview.chromium.org/8059006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103234 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/api/dev/ppb_ime_input_event_dev.idl29
-rw-r--r--ppapi/api/dev/ppb_text_input_dev.idl4
-rw-r--r--ppapi/api/ppb_input_event.idl6
-rw-r--r--ppapi/c/dev/ppb_ime_input_event_dev.h30
-rw-r--r--ppapi/c/dev/ppb_text_input_dev.h6
-rw-r--r--ppapi/c/ppb_input_event.h8
-rw-r--r--ppapi/cpp/dev/ime_input_event_dev.cc13
-rw-r--r--ppapi/cpp/dev/ime_input_event_dev.h22
-rw-r--r--ppapi/cpp/dev/text_input_dev.cc7
-rw-r--r--ppapi/cpp/dev/text_input_dev.h1
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc6
-rw-r--r--ppapi/ppapi_proxy.gypi2
-rw-r--r--ppapi/ppapi_shared.gypi2
-rw-r--r--ppapi/proxy/interface_id.h1
-rw-r--r--ppapi/proxy/interface_list.cc3
-rw-r--r--ppapi/proxy/ppapi_messages.h17
-rw-r--r--ppapi/proxy/ppb_text_input_proxy.cc84
-rw-r--r--ppapi/proxy/ppb_text_input_proxy.h56
-rw-r--r--ppapi/shared_impl/function_group_base.h1
-rw-r--r--ppapi/shared_impl/input_event_impl.cc29
-rw-r--r--ppapi/shared_impl/input_event_impl.h11
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h5
-rw-r--r--ppapi/thunk/ppb_input_event_api.h5
-rw-r--r--ppapi/thunk/ppb_input_event_thunk.cc62
-rw-r--r--ppapi/thunk/ppb_text_input_api.h32
-rw-r--r--ppapi/thunk/ppb_text_input_thunk.cc47
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/plugins/ppapi/event_conversion.cc6
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc1
-rw-r--r--webkit/plugins/ppapi/ppb_text_input_impl.cc59
-rw-r--r--webkit/plugins/ppapi/ppb_text_input_impl.h44
-rw-r--r--webkit/plugins/ppapi/resource_tracker.cc5
32 files changed, 520 insertions, 86 deletions
diff --git a/ppapi/api/dev/ppb_ime_input_event_dev.idl b/ppapi/api/dev/ppb_ime_input_event_dev.idl
index 6899008..6f484e2 100644
--- a/ppapi/api/dev/ppb_ime_input_event_dev.idl
+++ b/ppapi/api/dev/ppb_ime_input_event_dev.idl
@@ -46,30 +46,25 @@ interface PPB_IMEInputEvent_Dev {
uint32_t GetSegmentNumber([in] 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.
+ * GetSegmentOffset() returns the position of the index-th segmentation point
+ * in the composition text. The position is given by a byte-offset (not a
+ * character-offset) of the string returned by GetText(). It always satisfies
+ * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1)
+ * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()).
+ * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range
+ * of the i-th segment, and hence GetSegmentNumber() can be a valid argument
+ * to this function instead of an off-by-1 error.
*
* @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.
+ * @return The byte-offset of the segmentation point. If the event is not
+ * COMPOSITION_UPDATE or index is out of range, returns 0.
*/
- PP_Bool GetSegmentAt([in] PP_Resource ime_event,
- [in] uint32_t index,
- [out] uint32_t start,
- [out] uint32_t end);
+ uint32_t GetSegmentOffset([in] PP_Resource ime_event,
+ [in] uint32_t index);
/**
* GetTargetSegment() returns the index of the current target segment of
diff --git a/ppapi/api/dev/ppb_text_input_dev.idl b/ppapi/api/dev/ppb_text_input_dev.idl
index f534b65..be4065e 100644
--- a/ppapi/api/dev/ppb_text_input_dev.idl
+++ b/ppapi/api/dev/ppb_text_input_dev.idl
@@ -61,10 +61,6 @@ interface PPB_TextInput_Dev {
void UpdateCaretPosition([in] PP_Instance instance,
[in] PP_Rect caret,
[in] PP_Rect bounding_box);
- /**
- * Forces to commit the current composition text in IME.
- */
- void ConfirmCompositionText([in] PP_Instance instance);
/**
* Cancels the current composition in IME.
diff --git a/ppapi/api/ppb_input_event.idl b/ppapi/api/ppb_input_event.idl
index 1f95a86..98fa7b0 100644
--- a/ppapi/api/ppb_input_event.idl
+++ b/ppapi/api/ppb_input_event.idl
@@ -107,21 +107,21 @@ enum PP_InputEvent_Type {
*
* Register for this event using the PP_INPUTEVENT_CLASS_IME class.
*/
- PP_INPUTEVENT_TYPE_COMPOSITION_START = 11,
+ PP_INPUTEVENT_TYPE_IME_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,
+ PP_INPUTEVENT_TYPE_IME_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,
+ PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13,
/**
* Notification that an input method committed a string.
diff --git a/ppapi/c/dev/ppb_ime_input_event_dev.h b/ppapi/c/dev/ppb_ime_input_event_dev.h
index 0131632..519a301 100644
--- a/ppapi/c/dev/ppb_ime_input_event_dev.h
+++ b/ppapi/c/dev/ppb_ime_input_event_dev.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_ime_input_event_dev.idl modified Thu Sep 15 17:06:09 2011. */
+/* From dev/ppb_ime_input_event_dev.idl modified Wed Sep 21 12:31:56 2011. */
#ifndef PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_
#define PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_
@@ -58,30 +58,24 @@ struct PPB_IMEInputEvent_Dev {
*/
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.
+ * GetSegmentOffset() returns the position of the index-th segmentation point
+ * in the composition text. The position is given by a byte-offset (not a
+ * character-offset) of the string returned by GetText(). It always satisfies
+ * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1)
+ * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()).
+ * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range
+ * of the i-th segment, and hence GetSegmentNumber() can be a valid argument
+ * to this function instead of an off-by-1 error.
*
* @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.
+ * @return The byte-offset of the segmentation point. If the event is not
+ * COMPOSITION_UPDATE or index is out of range, returns 0.
*/
- PP_Bool (*GetSegmentAt)(PP_Resource ime_event,
- uint32_t index,
- uint32_t* start,
- uint32_t* end);
+ uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index);
/**
* GetTargetSegment() returns the index of the current target segment of
* composition.
diff --git a/ppapi/c/dev/ppb_text_input_dev.h b/ppapi/c/dev/ppb_text_input_dev.h
index 51c990e..3eca1a3 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 Sep 14 12:51:46 2011. */
+/* From dev/ppb_text_input_dev.idl modified Tue Sep 27 14:34:33 2011. */
#ifndef PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
#define PPAPI_C_DEV_PPB_TEXT_INPUT_DEV_H_
@@ -84,10 +84,6 @@ struct PPB_TextInput_Dev {
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);
diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h
index 21b7c12..8348ffe 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 Sep 14 12:46:14 2011. */
+/* From ppb_input_event.idl modified Wed Sep 21 12:32:06 2011. */
#ifndef PPAPI_C_PPB_INPUT_EVENT_H_
#define PPAPI_C_PPB_INPUT_EVENT_H_
@@ -123,19 +123,19 @@ typedef enum {
*
* Register for this event using the PP_INPUTEVENT_CLASS_IME class.
*/
- PP_INPUTEVENT_TYPE_COMPOSITION_START = 11,
+ PP_INPUTEVENT_TYPE_IME_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,
+ PP_INPUTEVENT_TYPE_IME_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,
+ PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13,
/**
* Notification that an input method committed a string.
*
diff --git a/ppapi/cpp/dev/ime_input_event_dev.cc b/ppapi/cpp/dev/ime_input_event_dev.cc
index 21fe879..bc1f387 100644
--- a/ppapi/cpp/dev/ime_input_event_dev.cc
+++ b/ppapi/cpp/dev/ime_input_event_dev.cc
@@ -49,16 +49,11 @@ uint32_t IMEInputEvent_Dev::GetSegmentNumber() const {
pp_resource());
}
-std::pair<uint32_t, uint32_t>
-IMEInputEvent_Dev::GetSegmentAt(uint32_t index) const {
- std::pair<uint32_t, uint32_t> range(0, 0);
+uint32_t IMEInputEvent_Dev::GetSegmentOffset(uint32_t index) const {
if (!has_interface<PPB_IMEInputEvent_Dev>())
- return range;
- get_interface<PPB_IMEInputEvent_Dev>()->GetSegmentAt(pp_resource(),
- index,
- &range.first,
- &range.second);
- return range;
+ return 0;
+ return get_interface<PPB_IMEInputEvent_Dev>()->GetSegmentOffset(pp_resource(),
+ index);
}
int32_t IMEInputEvent_Dev::GetTargetSegment() const {
diff --git a/ppapi/cpp/dev/ime_input_event_dev.h b/ppapi/cpp/dev/ime_input_event_dev.h
index 3c9b4a3..17216a8 100644
--- a/ppapi/cpp/dev/ime_input_event_dev.h
+++ b/ppapi/cpp/dev/ime_input_event_dev.h
@@ -41,17 +41,23 @@ class IMEInputEvent_Dev : public InputEvent {
/// returns 0.
uint32_t GetSegmentNumber() const;
- /// Returns the start and the end position of the index-th segment in the
- /// composition text. The positions are given by byte-indices of the string
- /// GetText(). They always satisfy 0 <= .first < .second <= (Length of
- /// GetText()) and GetSegmentAt(index).first < GetSegmentAt(index+1).first.
- /// When the event is not COMPOSITION_UPDATE or index >= GetSegmentNumber(),
- /// returns (0, 0).
+ /// Returns the position of the index-th segmentation point in the composition
+ /// text. The position is given by a byte-offset (not a character-offset) of
+ /// the string returned by GetText(). It always satisfies
+ /// 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1)
+ /// < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()).
+ /// Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the
+ /// range of the i-th segment, and hence GetSegmentNumber() can be a valid
+ /// argument to this function instead of an off-by-1 error.
+ ///
+ /// @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
+ /// event.
///
/// @param[in] index An integer indicating a segment.
///
- /// @return A pair of integers representing the index-th segment.
- std::pair<uint32_t, uint32_t> GetSegmentAt(uint32_t index) const;
+ /// @return The byte-offset of the segmentation point. If the event is not
+ /// COMPOSITION_UPDATE or index is out of range, returns 0.
+ uint32_t GetSegmentOffset(uint32_t index) const;
/// Returns the index of the current target segment of composition.
///
diff --git a/ppapi/cpp/dev/text_input_dev.cc b/ppapi/cpp/dev/text_input_dev.cc
index 3ead040..6388836 100644
--- a/ppapi/cpp/dev/text_input_dev.cc
+++ b/ppapi/cpp/dev/text_input_dev.cc
@@ -40,13 +40,6 @@ void TextInput_Dev::UpdateCaretPosition(const Rect& caret,
instance_->pp_instance(), &caret.pp_rect(), &bounding_box.pp_rect());
}
-void TextInput_Dev::ConfirmCompositionText() {
- if (!has_interface<PPB_TextInput_Dev>())
- return;
- get_interface<PPB_TextInput_Dev>()->ConfirmCompositionText(
- instance_->pp_instance());
-}
-
void TextInput_Dev::CancelCompositionText() {
if (!has_interface<PPB_TextInput_Dev>())
return;
diff --git a/ppapi/cpp/dev/text_input_dev.h b/ppapi/cpp/dev/text_input_dev.h
index 2283bf7..79fadd6 100644
--- a/ppapi/cpp/dev/text_input_dev.h
+++ b/ppapi/cpp/dev/text_input_dev.h
@@ -21,7 +21,6 @@ class TextInput_Dev {
void SetTextInputType(PP_TextInput_Type type);
void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box);
- void ConfirmCompositionText();
void CancelCompositionText();
private:
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
index b6fcb79..0448da2 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_input_event.cc
@@ -69,9 +69,9 @@ PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) {
case PP_INPUTEVENT_TYPE_UNDEFINED:
return PP_FALSE;
// TODO(nfullagar): Implement support for event types below.
- case PP_INPUTEVENT_TYPE_COMPOSITION_START:
- case PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE:
- case PP_INPUTEVENT_TYPE_COMPOSITION_END:
+ case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START:
+ case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE:
+ case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END:
case PP_INPUTEVENT_TYPE_IME_TEXT:
DebugPrintf(" No implementation for event type %d\n",
data.event_type);
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 30cdf37..296d5e6 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -110,6 +110,8 @@
'proxy/ppb_surface_3d_proxy.h',
'proxy/ppb_testing_proxy.cc',
'proxy/ppb_testing_proxy.h',
+ 'proxy/ppb_text_input_proxy.cc',
+ 'proxy/ppb_text_input_proxy.h',
'proxy/ppb_url_loader_proxy.cc',
'proxy/ppb_url_loader_proxy.h',
'proxy/ppb_url_response_info_proxy.cc',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 3817748..a072284 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -153,6 +153,8 @@
'thunk/ppb_scrollbar_thunk.cc',
'thunk/ppb_surface_3d_api.h',
'thunk/ppb_surface_3d_thunk.cc',
+ 'thunk/ppb_text_input_api.h',
+ 'thunk/ppb_text_input_thunk.cc',
'thunk/ppb_transport_api.h',
'thunk/ppb_transport_thunk.cc',
'thunk/ppb_url_loader_api.h',
diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h
index c18a02e..7f45bfa 100644
--- a/ppapi/proxy/interface_id.h
+++ b/ppapi/proxy/interface_id.h
@@ -42,6 +42,7 @@ enum InterfaceID {
INTERFACE_ID_PPB_PDF,
INTERFACE_ID_PPB_SURFACE_3D,
INTERFACE_ID_PPB_TESTING,
+ INTERFACE_ID_PPB_TEXT_INPUT,
INTERFACE_ID_PPB_URL_LOADER,
INTERFACE_ID_PPB_URL_RESPONSE_INFO,
INTERFACE_ID_PPB_URL_UTIL,
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 3ae9529..2511f3b 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -14,10 +14,12 @@
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
+#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_mouse_lock_dev.h"
#include "ppapi/c/dev/ppb_surface_3d_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppb_video_capture_dev.h"
@@ -78,6 +80,7 @@
#include "ppapi/proxy/ppb_pdf_proxy.h"
#include "ppapi/proxy/ppb_surface_3d_proxy.h"
#include "ppapi/proxy/ppb_testing_proxy.h"
+#include "ppapi/proxy/ppb_text_input_proxy.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
#include "ppapi/proxy/ppb_url_response_info_proxy.h"
#include "ppapi/proxy/ppb_url_util_proxy.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index bbdb34e..96280c4 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -19,6 +19,7 @@
#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/dev/pp_video_capture_dev.h"
+#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_instance.h"
@@ -44,6 +45,7 @@
IPC_ENUM_TRAITS(PP_InputEvent_Type)
IPC_ENUM_TRAITS(PP_InputEvent_MouseButton)
+IPC_ENUM_TRAITS(PP_TextInput_Type)
IPC_ENUM_TRAITS(PP_VideoDecoder_Profile)
IPC_ENUM_TRAITS(PP_VideoDecodeError_Dev)
@@ -113,6 +115,10 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::InputEventData)
IPC_STRUCT_TRAITS_MEMBER(wheel_scroll_by_page)
IPC_STRUCT_TRAITS_MEMBER(key_code)
IPC_STRUCT_TRAITS_MEMBER(character_text)
+ IPC_STRUCT_TRAITS_MEMBER(composition_segment_offsets)
+ IPC_STRUCT_TRAITS_MEMBER(composition_target_segment)
+ IPC_STRUCT_TRAITS_MEMBER(composition_selection_start)
+ IPC_STRUCT_TRAITS_MEMBER(composition_selection_end)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ppapi::PPB_URLRequestInfo_Data)
@@ -922,6 +928,17 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
PP_Instance /* instance */,
uint32 /* result */)
+// PPB_TextInput.
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBTextInput_SetTextInputType,
+ PP_Instance /* instance */,
+ PP_TextInput_Type /* type */)
+IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBTextInput_UpdateCaretPosition,
+ PP_Instance /* instance */,
+ PP_Rect /* caret */,
+ PP_Rect /* bounding_box */)
+IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBTextInput_CancelCompositionText,
+ PP_Instance /* instance */)
+
// PPB_URLLoader.
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLLoader_Create,
PP_Instance /* instance */,
diff --git a/ppapi/proxy/ppb_text_input_proxy.cc b/ppapi/proxy/ppb_text_input_proxy.cc
new file mode 100644
index 0000000..e4ada9b
--- /dev/null
+++ b/ppapi/proxy/ppb_text_input_proxy.cc
@@ -0,0 +1,84 @@
+// 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.
+
+#include "ppapi/proxy/ppb_text_input_proxy.h"
+
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace proxy {
+
+PPB_TextInput_Proxy::PPB_TextInput_Proxy(Dispatcher* dispatcher)
+ : InterfaceProxy(dispatcher) {
+}
+
+PPB_TextInput_Proxy::~PPB_TextInput_Proxy() {
+}
+
+ppapi::thunk::PPB_TextInput_FunctionAPI*
+PPB_TextInput_Proxy::AsPPB_TextInput_FunctionAPI() {
+ return this;
+}
+
+void PPB_TextInput_Proxy::SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) {
+ dispatcher()->Send(new PpapiHostMsg_PPBTextInput_SetTextInputType(
+ INTERFACE_ID_PPB_TEXT_INPUT, instance, type));
+}
+
+void PPB_TextInput_Proxy::UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect& caret,
+ const PP_Rect& bounding_box) {
+ dispatcher()->Send(new PpapiHostMsg_PPBTextInput_UpdateCaretPosition(
+ INTERFACE_ID_PPB_TEXT_INPUT, instance, caret, bounding_box));
+}
+
+void PPB_TextInput_Proxy::CancelCompositionText(PP_Instance instance) {
+ dispatcher()->Send(new PpapiHostMsg_PPBTextInput_CancelCompositionText(
+ INTERFACE_ID_PPB_TEXT_INPUT, instance));
+}
+
+bool PPB_TextInput_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(PPB_TextInput_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_SetTextInputType,
+ OnMsgSetTextInputType)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_UpdateCaretPosition,
+ OnMsgUpdateCaretPosition)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTextInput_CancelCompositionText,
+ OnMsgCancelCompositionText)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void PPB_TextInput_Proxy::OnMsgSetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) {
+ ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
+ true);
+ if (enter.succeeded())
+ enter.functions()->SetTextInputType(instance, type);
+}
+
+void PPB_TextInput_Proxy::OnMsgUpdateCaretPosition(PP_Instance instance,
+ PP_Rect caret,
+ PP_Rect bounding_box) {
+ ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
+ true);
+ if (enter.succeeded())
+ enter.functions()->UpdateCaretPosition(instance, caret, bounding_box);
+}
+
+void PPB_TextInput_Proxy::OnMsgCancelCompositionText(PP_Instance instance) {
+ ppapi::thunk::EnterFunctionNoLock<PPB_TextInput_FunctionAPI> enter(instance,
+ true);
+ if (enter.succeeded())
+ enter.functions()->CancelCompositionText(instance);
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ppb_text_input_proxy.h b/ppapi/proxy/ppb_text_input_proxy.h
new file mode 100644
index 0000000..e234f33
--- /dev/null
+++ b/ppapi/proxy/ppb_text_input_proxy.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef PPAPI_PPB_TEXT_INPUT_PROXY_H_
+#define PPAPI_PPB_TEXT_INPUT_PROXY_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/thunk/ppb_text_input_api.h"
+
+struct PPB_TextInput_Dev;
+
+namespace ppapi {
+namespace proxy {
+
+class PPB_TextInput_Proxy
+ : public InterfaceProxy,
+ public ppapi::thunk::PPB_TextInput_FunctionAPI {
+ public:
+ PPB_TextInput_Proxy(Dispatcher* dispatcher);
+ virtual ~PPB_TextInput_Proxy();
+
+ // FunctionGroupBase overrides.
+ ppapi::thunk::PPB_TextInput_FunctionAPI* AsPPB_TextInput_FunctionAPI()
+ OVERRIDE;
+
+ // PPB_TextInput_FunctionAPI implementation.
+ virtual void SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) OVERRIDE;
+ virtual void UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect& caret,
+ const PP_Rect& bounding_box) OVERRIDE;
+ virtual void CancelCompositionText(PP_Instance instance) OVERRIDE;
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+
+ static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_TEXT_INPUT;
+
+ private:
+ // Message handlers.
+ void OnMsgSetTextInputType(PP_Instance instance, PP_TextInput_Type type);
+ void OnMsgUpdateCaretPosition(PP_Instance instance,
+ PP_Rect caret,
+ PP_Rect bounding_box);
+ void OnMsgCancelCompositionText(PP_Instance instance);
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_TextInput_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PPB_TEXT_INPUT_PROXY_H_
diff --git a/ppapi/shared_impl/function_group_base.h b/ppapi/shared_impl/function_group_base.h
index 94d4140..e09b893 100644
--- a/ppapi/shared_impl/function_group_base.h
+++ b/ppapi/shared_impl/function_group_base.h
@@ -15,6 +15,7 @@
F(PPB_Font_FunctionAPI) \
F(PPB_Fullscreen_FunctionAPI) \
F(PPB_Instance_FunctionAPI) \
+ F(PPB_TextInput_FunctionAPI) \
F(ResourceCreationAPI)
namespace ppapi {
diff --git a/ppapi/shared_impl/input_event_impl.cc b/ppapi/shared_impl/input_event_impl.cc
index 8dc653a..d0ca57c 100644
--- a/ppapi/shared_impl/input_event_impl.cc
+++ b/ppapi/shared_impl/input_event_impl.cc
@@ -24,7 +24,10 @@ InputEventData::InputEventData()
wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)),
wheel_scroll_by_page(false),
key_code(0),
- character_text() {
+ character_text(),
+ composition_target_segment(-1),
+ composition_selection_start(0),
+ composition_selection_end(0) {
}
InputEventData::~InputEventData() {
@@ -102,5 +105,27 @@ PP_Var InputEventImpl::GetCharacterText() {
data_.character_text);
}
-} // namespace ppapi
+uint32_t InputEventImpl::GetIMESegmentNumber() {
+ if (data_.composition_segment_offsets.empty())
+ return 0;
+ return data_.composition_segment_offsets.size() - 1;
+}
+uint32_t InputEventImpl::GetIMESegmentOffset(uint32_t index) {
+ if (index >= data_.composition_segment_offsets.size())
+ return 0;
+ return data_.composition_segment_offsets[index];
+}
+
+int32_t InputEventImpl::GetIMETargetSegment() {
+ return data_.composition_target_segment;
+}
+
+void InputEventImpl::GetIMESelection(uint32_t* start, uint32_t* end) {
+ if (start)
+ *start = data_.composition_selection_start;
+ if (end)
+ *end = data_.composition_selection_end;
+}
+
+} // namespace ppapi
diff --git a/ppapi/shared_impl/input_event_impl.h b/ppapi/shared_impl/input_event_impl.h
index fc7fb92..094eb8c 100644
--- a/ppapi/shared_impl/input_event_impl.h
+++ b/ppapi/shared_impl/input_event_impl.h
@@ -6,6 +6,7 @@
#define PPAPI_SHARED_IMPL_INPUT_EVENT_IMPL_H_
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -41,6 +42,11 @@ struct PPAPI_SHARED_EXPORT InputEventData {
uint32_t key_code;
std::string character_text;
+
+ std::vector<uint32_t> composition_segment_offsets;
+ int32_t composition_target_segment;
+ uint32_t composition_selection_start;
+ uint32_t composition_selection_end;
};
// This simple class implements the PPB_InputEvent_API in terms of the
@@ -78,6 +84,10 @@ class PPAPI_SHARED_EXPORT InputEventImpl
virtual PP_Bool GetWheelScrollByPage() OVERRIDE;
virtual uint32_t GetKeyCode() OVERRIDE;
virtual PP_Var GetCharacterText() OVERRIDE;
+ virtual uint32_t GetIMESegmentNumber() OVERRIDE;
+ virtual uint32_t GetIMESegmentOffset(uint32_t index) OVERRIDE;
+ virtual int32_t GetIMETargetSegment() OVERRIDE;
+ virtual void GetIMESelection(uint32_t* start, uint32_t* end) OVERRIDE;
private:
InputEventData data_;
@@ -88,4 +98,3 @@ class PPAPI_SHARED_EXPORT InputEventImpl
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_INPUT_EVENT_IMPL_H_
-
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index 9e18cda..8231027 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -18,11 +18,14 @@ PROXIED_API(PPB_Graphics3D)
UNPROXIED_API(PPB_LayerCompositor)
UNPROXIED_API(PPB_Scrollbar)
PROXIED_API(PPB_Surface3D)
+PROXIED_API(PPB_TextInput)
UNPROXIED_API(PPB_Transport)
PROXIED_API(PPB_VideoCapture)
PROXIED_API(PPB_VideoDecoder)
UNPROXIED_API(PPB_Widget)
+PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1,
+ PPB_IMEInputEvent_Dev)
PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev)
PROXIED_IFACE(PPB_CharSet, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev)
PROXIED_IFACE(PPB_Context3D, PPB_CONTEXT_3D_DEV_INTERFACE_0_1,
@@ -50,6 +53,8 @@ UNPROXIED_IFACE(PPB_Scrollbar, PPB_SCROLLBAR_DEV_INTERFACE_0_5,
PPB_Scrollbar_0_5_Dev)
PROXIED_IFACE(PPB_Surface3D, PPB_SURFACE_3D_DEV_INTERFACE_0_2,
PPB_Surface3D_Dev)
+PROXIED_IFACE(PPB_TextInput, PPB_TEXTINPUT_DEV_INTERFACE_0_1,
+ PPB_TextInput_Dev)
UNPROXIED_IFACE(PPB_Transport, PPB_TRANSPORT_DEV_INTERFACE_0_7,
PPB_Transport_Dev)
PROXIED_IFACE(PPB_VideoCapture, PPB_VIDEO_CAPTURE_DEV_INTERFACE_0_1,
diff --git a/ppapi/thunk/ppb_input_event_api.h b/ppapi/thunk/ppb_input_event_api.h
index 28b6c58..f23c795 100644
--- a/ppapi/thunk/ppb_input_event_api.h
+++ b/ppapi/thunk/ppb_input_event_api.h
@@ -5,6 +5,7 @@
#ifndef PPAPI_THUNK_PPB_INPUT_EVENT_API_H_
#define PPAPI_THUNK_PPB_INPUT_EVENT_API_H_
+#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
@@ -34,6 +35,10 @@ class PPAPI_THUNK_EXPORT PPB_InputEvent_API {
virtual PP_Bool GetWheelScrollByPage() = 0;
virtual uint32_t GetKeyCode() = 0;
virtual PP_Var GetCharacterText() = 0;
+ virtual uint32_t GetIMESegmentNumber() = 0;
+ virtual uint32_t GetIMESegmentOffset(uint32_t index) = 0;
+ virtual int32_t GetIMETargetSegment() = 0;
+ virtual void GetIMESelection(uint32_t* start, uint32_t* end) = 0;
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 6028c6e..7c8820a 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -271,6 +271,64 @@ const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
&GetCharacterText
};
+// Composition -----------------------------------------------------------------
+
+PP_Bool IsIMEInputEvent(PP_Resource resource) {
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START ||
+ type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE ||
+ type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END ||
+ type == PP_INPUTEVENT_TYPE_IME_TEXT);
+}
+
+PP_Var GetIMEText(PP_Resource ime_event) {
+ return GetCharacterText(ime_event);
+}
+
+uint32_t GetIMESegmentNumber(PP_Resource ime_event) {
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetIMESegmentNumber();
+}
+
+uint32_t GetIMESegmentOffset(PP_Resource ime_event, uint32_t index) {
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetIMESegmentOffset(index);
+}
+
+int32_t GetIMETargetSegment(PP_Resource ime_event) {
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed())
+ return -1;
+ return enter.object()->GetIMETargetSegment();
+}
+
+void GetIMESelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed()) {
+ if (start)
+ *start = 0;
+ if (end)
+ *end = 0;
+ return;
+ }
+ enter.object()->GetIMESelection(start, end);
+}
+
+const PPB_IMEInputEvent_Dev g_ppb_ime_input_event_thunk = {
+ &IsIMEInputEvent,
+ &GetIMEText,
+ &GetIMESegmentNumber,
+ &GetIMESegmentOffset,
+ &GetIMETargetSegment,
+ &GetIMESelection
+};
+
} // namespace
const PPB_InputEvent* GetPPB_InputEvent_Thunk() {
@@ -293,5 +351,9 @@ const PPB_WheelInputEvent* GetPPB_WheelInputEvent_Thunk() {
return &g_ppb_wheel_input_event_thunk;
}
+const PPB_IMEInputEvent_Dev* GetPPB_IMEInputEvent_Dev_Thunk() {
+ return &g_ppb_ime_input_event_thunk;
+}
+
} // namespace thunk
} // namespace ppapi
diff --git a/ppapi/thunk/ppb_text_input_api.h b/ppapi/thunk/ppb_text_input_api.h
new file mode 100644
index 0000000..9d91833
--- /dev/null
+++ b/ppapi/thunk/ppb_text_input_api.h
@@ -0,0 +1,32 @@
+// 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.
+
+#ifndef PPAPI_THUNK_PPB_TEXT_INPUT_API_H_
+#define PPAPI_THUNK_PPB_TEXT_INPUT_API_H_
+
+#include "ppapi/c/dev/ppb_text_input_dev.h"
+#include "ppapi/proxy/interface_id.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_TextInput_FunctionAPI {
+ public:
+ virtual ~PPB_TextInput_FunctionAPI() {}
+
+ virtual void SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) = 0;
+ virtual void UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect& caret,
+ const PP_Rect& bounding_box) = 0;
+ virtual void CancelCompositionText(PP_Instance instance) = 0;
+
+ static const proxy::InterfaceID interface_id =
+ proxy::INTERFACE_ID_PPB_TEXT_INPUT;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TEXT_INPUT_API_H_
diff --git a/ppapi/thunk/ppb_text_input_thunk.cc b/ppapi/thunk/ppb_text_input_thunk.cc
new file mode 100644
index 0000000..c0aba99
--- /dev/null
+++ b/ppapi/thunk/ppb_text_input_thunk.cc
@@ -0,0 +1,47 @@
+// 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.
+
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_text_input_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) {
+ EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true);
+ if (enter.succeeded())
+ enter.functions()->SetTextInputType(instance, type);
+}
+
+void UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect* caret,
+ const PP_Rect* bounding_box) {
+ EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true);
+ if (enter.succeeded() && caret && bounding_box)
+ enter.functions()->UpdateCaretPosition(instance, *caret, *bounding_box);
+}
+
+void CancelCompositionText(PP_Instance instance) {
+ EnterFunction<PPB_TextInput_FunctionAPI> enter(instance, true);
+ if (enter.succeeded())
+ enter.functions()->CancelCompositionText(instance);
+}
+
+const PPB_TextInput_Dev g_ppb_textinput_thunk = {
+ &SetTextInputType,
+ &UpdateCaretPosition,
+ &CancelCompositionText,
+};
+
+} // namespace
+
+const PPB_TextInput_Dev* GetPPB_TextInput_Dev_Thunk() {
+ return &g_ppb_textinput_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index a6adf2b..e6ba8fd 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -274,6 +274,8 @@
'../plugins/ppapi/ppb_scrollbar_impl.h',
'../plugins/ppapi/ppb_surface_3d_impl.cc',
'../plugins/ppapi/ppb_surface_3d_impl.h',
+ '../plugins/ppapi/ppb_text_input_impl.cc',
+ '../plugins/ppapi/ppb_text_input_impl.h',
'../plugins/ppapi/ppb_uma_private_impl.cc',
'../plugins/ppapi/ppb_uma_private_impl.h',
'../plugins/ppapi/ppb_url_loader_impl.cc',
diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc
index 80df1f6..cec3a64 100644
--- a/webkit/plugins/ppapi/event_conversion.cc
+++ b/webkit/plugins/ppapi/event_conversion.cc
@@ -302,9 +302,9 @@ WebInputEvent* CreateWebInputEvent(const InputEventData& event) {
case PP_INPUTEVENT_TYPE_CHAR:
web_input_event.reset(BuildCharEvent(event));
break;
- case PP_INPUTEVENT_TYPE_COMPOSITION_START:
- case PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE:
- case PP_INPUTEVENT_TYPE_COMPOSITION_END:
+ case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START:
+ case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE:
+ case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END:
case PP_INPUTEVENT_TYPE_IME_TEXT:
// TODO(kinaba) implement in WebKit an event structure to handle
// composition events.
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index a1f0c8c..43fbd6f 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -32,6 +32,7 @@
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_surface_3d_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
diff --git a/webkit/plugins/ppapi/ppb_text_input_impl.cc b/webkit/plugins/ppapi/ppb_text_input_impl.cc
new file mode 100644
index 0000000..fc02925
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_text_input_impl.cc
@@ -0,0 +1,59 @@
+// 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.
+
+#include "webkit/plugins/ppapi/ppb_text_input_impl.h"
+
+#include "base/logging.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h"
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+
+namespace webkit {
+namespace ppapi {
+
+PPB_TextInput_Impl::PPB_TextInput_Impl(PluginInstance* instance)
+ : instance_(instance) {
+}
+
+::ppapi::thunk::PPB_TextInput_FunctionAPI*
+PPB_TextInput_Impl::AsPPB_TextInput_FunctionAPI() {
+ return this;
+}
+
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \
+ int(PP_TEXTINPUT_TYPE_NONE), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \
+ int(PP_TEXTINPUT_TYPE_TEXT), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \
+ int(PP_TEXTINPUT_TYPE_PASSWORD), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \
+ int(PP_TEXTINPUT_TYPE_SEARCH), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \
+ int(PP_TEXTINPUT_TYPE_EMAIL), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeNumber) == \
+ int(PP_TEXTINPUT_TYPE_NUMBER), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeTelephone) == \
+ int(PP_TEXTINPUT_TYPE_TELEPHONE), mismatching_enums);
+COMPILE_ASSERT(int(WebKit::WebTextInputTypeURL) == \
+ int(PP_TEXTINPUT_TYPE_URL), mismatching_enums);
+
+void PPB_TextInput_Impl::SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) {
+ // TODO(kinaba) the implementation is split to another CL for reviewing.
+ NOTIMPLEMENTED();
+}
+
+void PPB_TextInput_Impl::UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect& caret,
+ const PP_Rect& bounding_box) {
+ // TODO(kinaba) the implementation is split to another CL for reviewing.
+ NOTIMPLEMENTED();
+}
+
+void PPB_TextInput_Impl::CancelCompositionText(PP_Instance instance) {
+ // TODO(kinaba) the implementation is split to another CL for reviewing.
+ NOTIMPLEMENTED();
+}
+
+} // namespace ppapi
+} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_text_input_impl.h b/webkit/plugins/ppapi/ppb_text_input_impl.h
new file mode 100644
index 0000000..b6d25e1
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_text_input_impl.h
@@ -0,0 +1,44 @@
+// 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.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_TEXT_INPUT_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_TEXT_INPUT_IMPL_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/shared_impl/function_group_base.h"
+#include "ppapi/thunk/ppb_text_input_api.h"
+
+namespace webkit {
+namespace ppapi {
+
+class PluginInstance;
+
+class PPB_TextInput_Impl
+ : public ::ppapi::FunctionGroupBase,
+ public ::ppapi::thunk::PPB_TextInput_FunctionAPI {
+ public:
+ PPB_TextInput_Impl(PluginInstance* instance);
+
+ // FunctionGroupBase overrides.
+ virtual ::ppapi::thunk::PPB_TextInput_FunctionAPI*
+ AsPPB_TextInput_FunctionAPI() OVERRIDE;
+
+ // PPB_TextInput_FunctionAPI implementation.
+ virtual void SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) OVERRIDE;
+ virtual void UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect& caret,
+ const PP_Rect& bounding_box) OVERRIDE;
+ virtual void CancelCompositionText(PP_Instance instance) OVERRIDE;
+
+ private:
+ PluginInstance* instance_;
+ DISALLOW_COPY_AND_ASSIGN(PPB_TextInput_Impl);
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_TEXT_INPUT_IMPL_H_
diff --git a/webkit/plugins/ppapi/resource_tracker.cc b/webkit/plugins/ppapi/resource_tracker.cc
index c69fb5f..770384b 100644
--- a/webkit/plugins/ppapi/resource_tracker.cc
+++ b/webkit/plugins/ppapi/resource_tracker.cc
@@ -21,6 +21,7 @@
#include "webkit/plugins/ppapi/ppb_char_set_impl.h"
#include "webkit/plugins/ppapi/ppb_cursor_control_impl.h"
#include "webkit/plugins/ppapi/ppb_font_impl.h"
+#include "webkit/plugins/ppapi/ppb_text_input_impl.h"
#include "webkit/plugins/ppapi/resource_creation_impl.h"
#include "webkit/plugins/ppapi/resource_helper.h"
@@ -144,6 +145,9 @@ void ResourceTracker::CleanupInstanceData(PP_Instance instance,
case ::ppapi::proxy::INTERFACE_ID_PPB_FONT:
proxy.reset(new PPB_Font_FunctionImpl(instance));
break;
+ case ::ppapi::proxy::INTERFACE_ID_PPB_TEXT_INPUT:
+ proxy.reset(new PPB_TextInput_Impl(instance));
+ break;
case ::ppapi::proxy::INTERFACE_ID_RESOURCE_CREATION:
proxy.reset(new ResourceCreationImpl(instance));
break;
@@ -323,4 +327,3 @@ void ResourceTracker::ClearSingletonOverride() {
} // namespace ppapi
} // namespace webkit
-