diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 08:35:55 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 08:35:55 +0000 |
commit | 40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17 (patch) | |
tree | 5e37fa314f54e15dd72c9a28cb1bad463800a00e /ppapi | |
parent | a5bd413ae6ca86fce6922fcd19c111eaeb7232f4 (diff) | |
download | chromium_src-40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17.zip chromium_src-40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17.tar.gz chromium_src-40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17.tar.bz2 |
Revert 102897 - Additional update on Pepper IME API and boilerplate thunk/proxy implementation.
BUG=59425
TEST=Check that ppapi_tests compile.
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/7978019
TBR=kinaba@chromium.org
Review URL: http://codereview.chromium.org/8060005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
27 files changed, 82 insertions, 408 deletions
diff --git a/ppapi/api/dev/ppb_ime_input_event_dev.idl b/ppapi/api/dev/ppb_ime_input_event_dev.idl index 6f484e2..6899008 100644 --- a/ppapi/api/dev/ppb_ime_input_event_dev.idl +++ b/ppapi/api/dev/ppb_ime_input_event_dev.idl @@ -46,25 +46,30 @@ interface PPB_IMEInputEvent_Dev { uint32_t GetSegmentNumber([in] PP_Resource ime_event); /** - * 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. + * 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. * - * @return The byte-offset of the segmentation point. If the event is not - * COMPOSITION_UPDATE or index is out of range, returns 0. + * @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. */ - uint32_t GetSegmentOffset([in] PP_Resource ime_event, - [in] uint32_t index); + PP_Bool GetSegmentAt([in] PP_Resource ime_event, + [in] uint32_t index, + [out] uint32_t start, + [out] uint32_t end); /** * 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 be4065e..f534b65 100644 --- a/ppapi/api/dev/ppb_text_input_dev.idl +++ b/ppapi/api/dev/ppb_text_input_dev.idl @@ -61,6 +61,10 @@ 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 98fa7b0..1f95a86 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_IME_COMPOSITION_START = 11, + 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_IME_COMPOSITION_UPDATE = 12, + 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_IME_COMPOSITION_END = 13, + PP_INPUTEVENT_TYPE_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 519a301..0131632 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 Wed Sep 21 12:31:56 2011. */ +/* 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_ @@ -58,24 +58,30 @@ struct PPB_IMEInputEvent_Dev { */ uint32_t (*GetSegmentNumber)(PP_Resource ime_event); /** - * 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. + * 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. * - * @return The byte-offset of the segmentation point. If the event is not - * COMPOSITION_UPDATE or index is out of range, returns 0. + * @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. */ - uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); + 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. diff --git a/ppapi/c/dev/ppb_text_input_dev.h b/ppapi/c/dev/ppb_text_input_dev.h index 3eca1a3..51c990e 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 Tue Sep 27 14:34:33 2011. */ +/* 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_ @@ -84,6 +84,10 @@ 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 8348ffe..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 Sep 21 12:32:06 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_ @@ -123,19 +123,19 @@ typedef enum { * * Register for this event using the PP_INPUTEVENT_CLASS_IME class. */ - PP_INPUTEVENT_TYPE_IME_COMPOSITION_START = 11, + 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_IME_COMPOSITION_UPDATE = 12, + 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_IME_COMPOSITION_END = 13, + PP_INPUTEVENT_TYPE_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 bc1f387..21fe879 100644 --- a/ppapi/cpp/dev/ime_input_event_dev.cc +++ b/ppapi/cpp/dev/ime_input_event_dev.cc @@ -49,11 +49,16 @@ uint32_t IMEInputEvent_Dev::GetSegmentNumber() const { pp_resource()); } -uint32_t IMEInputEvent_Dev::GetSegmentOffset(uint32_t index) const { +std::pair<uint32_t, uint32_t> +IMEInputEvent_Dev::GetSegmentAt(uint32_t index) const { + std::pair<uint32_t, uint32_t> range(0, 0); if (!has_interface<PPB_IMEInputEvent_Dev>()) - return 0; - return get_interface<PPB_IMEInputEvent_Dev>()->GetSegmentOffset(pp_resource(), - index); + return range; + get_interface<PPB_IMEInputEvent_Dev>()->GetSegmentAt(pp_resource(), + index, + &range.first, + &range.second); + return range; } 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 17216a8..3c9b4a3 100644 --- a/ppapi/cpp/dev/ime_input_event_dev.h +++ b/ppapi/cpp/dev/ime_input_event_dev.h @@ -41,23 +41,17 @@ class IMEInputEvent_Dev : public InputEvent { /// returns 0. uint32_t GetSegmentNumber() const; - /// 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. + /// 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). /// /// @param[in] index An integer indicating a segment. /// - /// @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; + /// @return A pair of integers representing the index-th segment. + std::pair<uint32_t, uint32_t> GetSegmentAt(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 6388836..3ead040 100644 --- a/ppapi/cpp/dev/text_input_dev.cc +++ b/ppapi/cpp/dev/text_input_dev.cc @@ -40,6 +40,13 @@ 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 79fadd6..2283bf7 100644 --- a/ppapi/cpp/dev/text_input_dev.h +++ b/ppapi/cpp/dev/text_input_dev.h @@ -21,6 +21,7 @@ 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 0448da2..b6fcb79 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_IME_COMPOSITION_START: - case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: - case PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: + case PP_INPUTEVENT_TYPE_COMPOSITION_START: + case PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE: + case PP_INPUTEVENT_TYPE_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 296d5e6..30cdf37 100644 --- a/ppapi/ppapi_proxy.gypi +++ b/ppapi/ppapi_proxy.gypi @@ -110,8 +110,6 @@ '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 a072284..3817748 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -153,8 +153,6 @@ '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 7f45bfa..c18a02e 100644 --- a/ppapi/proxy/interface_id.h +++ b/ppapi/proxy/interface_id.h @@ -42,7 +42,6 @@ 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 2511f3b..3ae9529 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -14,12 +14,10 @@ #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" @@ -80,7 +78,6 @@ #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 96280c4..bbdb34e 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -19,7 +19,6 @@ #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" @@ -45,7 +44,6 @@ 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) @@ -115,10 +113,6 @@ 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) @@ -928,17 +922,6 @@ 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 deleted file mode 100644 index e4ada9b..0000000 --- a/ppapi/proxy/ppb_text_input_proxy.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 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 deleted file mode 100644 index e234f33..0000000 --- a/ppapi/proxy/ppb_text_input_proxy.h +++ /dev/null @@ -1,56 +0,0 @@ -// 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 e09b893..94d4140 100644 --- a/ppapi/shared_impl/function_group_base.h +++ b/ppapi/shared_impl/function_group_base.h @@ -15,7 +15,6 @@ 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 d0ca57c..8dc653a 100644 --- a/ppapi/shared_impl/input_event_impl.cc +++ b/ppapi/shared_impl/input_event_impl.cc @@ -24,10 +24,7 @@ InputEventData::InputEventData() wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)), wheel_scroll_by_page(false), key_code(0), - character_text(), - composition_target_segment(-1), - composition_selection_start(0), - composition_selection_end(0) { + character_text() { } InputEventData::~InputEventData() { @@ -105,27 +102,5 @@ PP_Var InputEventImpl::GetCharacterText() { data_.character_text); } -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 094eb8c..fc7fb92 100644 --- a/ppapi/shared_impl/input_event_impl.h +++ b/ppapi/shared_impl/input_event_impl.h @@ -6,7 +6,6 @@ #define PPAPI_SHARED_IMPL_INPUT_EVENT_IMPL_H_ #include <string> -#include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -42,11 +41,6 @@ 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 @@ -84,10 +78,6 @@ 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_; @@ -98,3 +88,4 @@ 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 8231027..9e18cda 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -18,14 +18,11 @@ 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, @@ -53,8 +50,6 @@ 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 f23c795..28b6c58 100644 --- a/ppapi/thunk/ppb_input_event_api.h +++ b/ppapi/thunk/ppb_input_event_api.h @@ -5,7 +5,6 @@ #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" @@ -35,10 +34,6 @@ 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 7c8820a..6028c6e 100644 --- a/ppapi/thunk/ppb_input_event_thunk.cc +++ b/ppapi/thunk/ppb_input_event_thunk.cc @@ -271,64 +271,6 @@ 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() { @@ -351,9 +293,5 @@ 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 deleted file mode 100644 index 9d91833..0000000 --- a/ppapi/thunk/ppb_text_input_api.h +++ /dev/null @@ -1,32 +0,0 @@ -// 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 deleted file mode 100644 index b0bdd15..0000000 --- a/ppapi/thunk/ppb_text_input_thunk.cc +++ /dev/null @@ -1,46 +0,0 @@ -// 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/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/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h index 1130a0c..fe90eff 100644 --- a/ppapi/thunk/thunk.h +++ b/ppapi/thunk/thunk.h @@ -41,7 +41,6 @@ struct PPB_Graphics3DTrusted; struct PPB_ImageDataTrusted; struct PPB_Instance_Private; struct PPB_QueryPolicy_Dev; -struct PPB_TextInput_Dev; struct PPB_URLLoaderTrusted; typedef PPB_Instance PPB_Instance_1_0; @@ -68,7 +67,6 @@ PPAPI_THUNK_EXPORT const PPB_Graphics3DTrusted* PPAPI_THUNK_EXPORT const PPB_ImageDataTrusted* GetPPB_ImageDataTrusted_Thunk(); PPAPI_THUNK_EXPORT const PPB_Instance_Private* GetPPB_Instance_Private_Thunk(); PPAPI_THUNK_EXPORT const PPB_QueryPolicy_Dev* GetPPB_QueryPolicy_Thunk(); -PPAPI_THUNK_EXPORT const PPB_TextInput_Dev* GetPPB_TextInput_Thunk(); PPAPI_THUNK_EXPORT const PPB_URLLoaderTrusted* GetPPB_URLLoaderTrusted_Thunk(); } // namespace thunk |