diff options
28 files changed, 326 insertions, 223 deletions
diff --git a/ppapi/api/ppp_instance.idl b/ppapi/api/ppp_instance.idl index aeb95b1..da8f7a9 100644 --- a/ppapi/api/ppp_instance.idl +++ b/ppapi/api/ppp_instance.idl @@ -9,7 +9,7 @@ */ label Chrome { - M14 = 1.0 + M14 = 0.5 }; /** @@ -161,13 +161,11 @@ interface PPP_Instance { * An instance's default condition is that it will not have focus. * * <strong>Note:</strong>Clicks on instances will give focus only if you - * handle the click event. Return <code>true</code> from - * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use - * unfiltered events) to signal that the click event was handled. Otherwise, - * the browser will bubble the event and give focus to the element on the page - * that actually did end up consuming it. If you're not getting focus, check - * to make sure you're returning true from the mouse click in - * <code>HandleInputEvent</code>. + * handle the click event. Return <code>true</code> from HandleInputEvent to + * signal that the click event was handled. Otherwise the browser will bubble + * the event and give focus to the element on the page that actually did end + * up consuming it. If you're not getting focus, check to make sure you're + * returning true from the mouse click in <code>HandleInputEvent</code>. * * @param[in] instance A <code>PP_Instance</code> indentifying the instance * receiving the input event. @@ -181,6 +179,37 @@ interface PPP_Instance { [in] PP_Bool has_focus); /** + * HandleInputEvent() handles input events, such as keyboard events. This + * function returns <code>PP_TRUE</code> if the event was handled or + * <code>PP_FALSE</code> if it was not. + * + * If the event was handled, it will not be forwarded to the web page or + * browser. If it was not handled, it will bubble according to the normal + * rules. So it is important that a module respond accurately with whether + * event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false means + * that the click will be given to a lower part of the page and your module + * will not receive focus. This allows an instance to be partially + * transparent, where clicks on the transparent areas will behave like clicks + * to the underlying page. + * + * @param[in] instance A <code>PP_Instance</code> indentifying one instance + * of a module. + * + * @param[in] event The input event. + * + * @return <code>PP_TRUE</code> if <code>event</code> was handled, + * <code>PP_FALSE</code> otherwise. + */ + PP_Bool HandleInputEvent( + /* A PP_Instance indentifying one instance of a module. */ + [in] PP_Instance instance, + /* The event. */ + [in] PP_InputEvent event); + + /** * HandleDocumentLoad() is called after initialize for a full-frame * module that was instantiated based on the MIME type of a DOMWindow * navigation. This situation only applies to modules that are pre-registered diff --git a/ppapi/c/pp_input_event.h b/ppapi/c/pp_input_event.h index c3defc9..0c7854c 100644 --- a/ppapi/c/pp_input_event.h +++ b/ppapi/c/pp_input_event.h @@ -192,6 +192,44 @@ struct PP_InputEvent_Wheel { PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); /** + * The PP_InputEventData union represents all input event data types. + */ +union PP_InputEventData { + struct PP_InputEvent_Key key; + struct PP_InputEvent_Character character; + struct PP_InputEvent_Mouse mouse; + struct PP_InputEvent_Wheel wheel; + /** + * This value allows new events to be added without changing the size of + * this struct. + */ + char padding[64]; +}; + +/** + * The PP_InputEvent struct represents all input events. + */ +struct PP_InputEvent { + /** This value represents the type of the event. */ + PP_InputEvent_Type type; + /** This value ensure the time_stamp is aligned on an 8-byte boundary + * relative to the start of the struct. Some compilers align doubles + * on 8-byte boundaries for 32-bit x86, and some align on 4-byte boundaries. + */ + int32_t padding; + /** + * This value represents the time that this event was generated. This value + * is not relative to any particular epoch; the most you can do is compare + * time stamps. + */ + PP_TimeTicks time_stamp; + /** + * This value represents the event type and its specific data. + */ + union PP_InputEventData u; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); +/** * @} */ diff --git a/ppapi/c/ppp_instance.h b/ppapi/c/ppp_instance.h index 31f93a3..f38f0ae 100644 --- a/ppapi/c/ppp_instance.h +++ b/ppapi/c/ppp_instance.h @@ -38,8 +38,8 @@ * to handle events such as change of focus or input events (keyboard/mouse) * events. */ -#define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0" -#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_0 +#define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" +#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_5 struct PPP_Instance { /** @@ -154,13 +154,11 @@ struct PPP_Instance { * An instance's default condition is that it will not have focus. * * <strong>Note:</strong>Clicks on instances will give focus only if you - * handle the click event. Return <code>true</code> from - * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use - * unfiltered events) to signal that the click event was handled. Otherwise, - * the browser will bubble the event and give focus to the element on the page - * that actually did end up consuming it. If you're not getting focus, check - * to make sure you're returning true from the mouse click in - * <code>HandleInputEvent</code>. + * handle the click event. Return <code>true</code> from HandleInputEvent to + * signal that the click event was handled. Otherwise the browser will bubble + * the event and give focus to the element on the page that actually did end + * up consuming it. If you're not getting focus, check to make sure you're + * returning true from the mouse click in <code>HandleInputEvent</code>. * * @param[in] instance A <code>PP_Instance</code> indentifying the instance * receiving the input event. @@ -169,6 +167,33 @@ struct PPP_Instance { */ void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); /** + * HandleInputEvent() handles input events, such as keyboard events. This + * function returns <code>PP_TRUE</code> if the event was handled or + * <code>PP_FALSE</code> if it was not. + * + * If the event was handled, it will not be forwarded to the web page or + * browser. If it was not handled, it will bubble according to the normal + * rules. So it is important that a module respond accurately with whether + * event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false means + * that the click will be given to a lower part of the page and your module + * will not receive focus. This allows an instance to be partially + * transparent, where clicks on the transparent areas will behave like clicks + * to the underlying page. + * + * @param[in] instance A <code>PP_Instance</code> indentifying one instance + * of a module. + * + * @param[in] event The input event. + * + * @return <code>PP_TRUE</code> if <code>event</code> was handled, + * <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*HandleInputEvent)(PP_Instance instance, + const struct PP_InputEvent* event); + /** * HandleDocumentLoad() is called after initialize for a full-frame * module that was instantiated based on the MIME type of a DOMWindow * navigation. This situation only applies to modules that are pre-registered @@ -202,7 +227,7 @@ struct PPP_Instance { */ -typedef struct PPP_Instance PPP_Instance_1_0; +typedef struct PPP_Instance PPP_Instance_0_5; #endif /* PPAPI_C_PPP_INSTANCE_H_ */ diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc index 9bb77dc..75e9a1f 100644 --- a/ppapi/cpp/instance.cc +++ b/ppapi/cpp/instance.cc @@ -67,6 +67,10 @@ bool Instance::HandleDocumentLoad(const URLLoader& /*url_loader*/) { return false; } +bool Instance::HandleInputEvent(const PP_InputEvent& /*event*/) { + return false; +} + bool Instance::HandleInputEvent(const InputEvent& /*event*/) { return false; } diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h index f08c2d5..abf441f 100644 --- a/ppapi/cpp/instance.h +++ b/ppapi/cpp/instance.h @@ -154,7 +154,10 @@ class Instance { /// @param[in] event The input event. /// /// @return true if @a event was handled, false otherwise. - virtual bool HandleInputEvent(const pp::InputEvent& event); + virtual bool HandleInputEvent(const PP_InputEvent& event); + + /// @see InputEvent for an example + virtual bool HandleInputEvent(const InputEvent& event); /// Notification of a data stream available after an instance was created /// based on the MIME type of a DOMWindow navigation. This only applies to diff --git a/ppapi/cpp/module.cc b/ppapi/cpp/module.cc index b727e46..927710a 100644 --- a/ppapi/cpp/module.cc +++ b/ppapi/cpp/module.cc @@ -110,6 +110,17 @@ void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { instance->DidChangeFocus(PP_ToBool(has_focus)); } +PP_Bool Instance_HandleInputEvent(PP_Instance pp_instance, + const PP_InputEvent* event) { + Module* module_singleton = Module::Get(); + if (!module_singleton) + return PP_FALSE; + Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); + if (!instance) + return PP_FALSE; + return PP_FromBool(instance->HandleInputEvent(*event)); +} + PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, PP_Resource pp_url_loader) { Module* module_singleton = Module::Get(); @@ -126,6 +137,7 @@ static PPP_Instance instance_interface = { &Instance_DidDestroy, &Instance_DidChangeView, &Instance_DidChangeFocus, + &Instance_HandleInputEvent, &Instance_HandleDocumentLoad }; diff --git a/ppapi/examples/2d/graphics_2d_example.c b/ppapi/examples/2d/graphics_2d_example.c index 6495cdc..ccec9a1 100644 --- a/ppapi/examples/2d/graphics_2d_example.c +++ b/ppapi/examples/2d/graphics_2d_example.c @@ -157,6 +157,12 @@ void Instance_DidChangeView(PP_Instance pp_instance, void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { } +PP_Bool Instance_HandleInputEvent(PP_Instance pp_instance, + const struct PP_InputEvent* event) { + /* We don't handle any events. */ + return PP_FALSE; +} + PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, PP_Resource pp_url_loader) { return PP_FALSE; @@ -167,6 +173,7 @@ static struct PPP_Instance instance_interface = { &Instance_DidDestroy, &Instance_DidChangeView, &Instance_DidChangeFocus, + &Instance_HandleInputEvent, &Instance_HandleDocumentLoad }; diff --git a/ppapi/examples/2d/paint_manager_example.cc b/ppapi/examples/2d/paint_manager_example.cc index c129f07..8a5a2f5 100644 --- a/ppapi/examples/2d/paint_manager_example.cc +++ b/ppapi/examples/2d/paint_manager_example.cc @@ -5,7 +5,6 @@ #include "ppapi/c/pp_input_event.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" -#include "ppapi/cpp/input_event.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/paint_manager.h" @@ -42,26 +41,25 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client { last_x_(0), last_y_(0) { paint_manager_.Initialize(this, this, false); - RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); } - virtual bool HandleInputEvent(const pp::InputEvent& event) { - switch (event.GetType()) { + virtual bool HandleInputEvent(const PP_InputEvent& event) { + switch (event.type) { case PP_INPUTEVENT_TYPE_MOUSEDOWN: { - pp::MouseInputEvent mouse_event(event); + const PP_InputEvent_Mouse& mouse_event = event.u.mouse; // Update the square on a mouse down. - if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { - UpdateSquare(static_cast<int>(mouse_event.GetMousePosition().x()), - static_cast<int>(mouse_event.GetMousePosition().y())); + if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { + UpdateSquare(static_cast<int>(mouse_event.x), + static_cast<int>(mouse_event.y)); } return true; } case PP_INPUTEVENT_TYPE_MOUSEMOVE: { - pp::MouseInputEvent mouse_event(event); + const PP_InputEvent_Mouse& mouse_event = event.u.mouse; // Update the square on a drag. - if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { - UpdateSquare(static_cast<int>(mouse_event.GetMousePosition().x()), - static_cast<int>(mouse_event.GetMousePosition().y())); + if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { + UpdateSquare(static_cast<int>(mouse_event.x), + static_cast<int>(mouse_event.y)); } return true; } diff --git a/ppapi/examples/file_chooser/file_chooser.cc b/ppapi/examples/file_chooser/file_chooser.cc index e1eb6bd..598095f 100644 --- a/ppapi/examples/file_chooser/file_chooser.cc +++ b/ppapi/examples/file_chooser/file_chooser.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -7,7 +7,6 @@ #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/dev/file_chooser_dev.h" #include "ppapi/cpp/file_ref.h" -#include "ppapi/cpp/input_event.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/private/instance_private.h" #include "ppapi/cpp/private/var_private.h" @@ -17,17 +16,15 @@ class MyInstance : public pp::InstancePrivate { MyInstance(PP_Instance instance) : pp::InstancePrivate(instance) { callback_factory_.Initialize(this); - RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); } - virtual bool HandleInputEvent(const pp::InputEvent& event) { - switch (event.GetType()) { + virtual bool HandleInputEvent(const PP_InputEvent& event) { + switch (event.type) { case PP_INPUTEVENT_TYPE_MOUSEDOWN: { - pp::MouseInputEvent mouse_event(event); - if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) + const PP_InputEvent_Mouse& mouse_event = event.u.mouse; + if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) ShowFileChooser(false); - else if (mouse_event.GetMouseButton() - == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) + else if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) ShowFileChooser(true); else return false; diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index 5de70c0..69e16ac 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -165,7 +165,7 @@ InterfaceList::InterfaceList() { AddPPP(PPP_Graphics3D_Proxy::GetInfo()); AddPPP(PPP_InputEvent_Proxy::GetInfo()); AddPPP(PPP_Instance_Private_Proxy::GetInfo()); - AddPPP(PPP_Instance_Proxy::GetInfo1_0()); + AddPPP(PPP_Instance_Proxy::GetInfo0_5()); } void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index f4739e8..41853ae 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -293,6 +293,10 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPPInstance_DidChangeView, IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInstance_DidChangeFocus, PP_Instance /* instance */, PP_Bool /* has_focus */) +IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleInputEvent, + PP_Instance /* instance */, + PP_InputEvent /* event */, + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleDocumentLoad, PP_Instance /* instance */, pp::proxy::HostResource /* url_loader */, diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 29e51bb..87c253b 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -171,6 +171,30 @@ void ParamTraits<PP_Flash_NetAddress>::Log(const param_type& p, l->append(" bytes)>"); } +// PP_InputEvent --------------------------------------------------------------- + +// static +void ParamTraits<PP_InputEvent>::Write(Message* m, const param_type& p) { + // PP_InputEvent is just POD so we can just memcpy it. + m->WriteData(reinterpret_cast<const char*>(&p), sizeof(PP_InputEvent)); +} + +// static +bool ParamTraits<PP_InputEvent>::Read(const Message* m, + void** iter, + param_type* r) { + const char* data; + int data_size; + if (!m->ReadData(iter, &data, &data_size)) + return false; + memcpy(r, data, sizeof(PP_InputEvent)); + return true; +} + +// static +void ParamTraits<PP_InputEvent>::Log(const param_type& p, std::string* l) { +} + // PP_ObjectProperty ----------------------------------------------------------- // static diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index 736120f..0db47cd 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -11,6 +11,7 @@ #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" #include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_input_event.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_var.h" @@ -61,6 +62,14 @@ struct ParamTraits<PP_Flash_NetAddress> { }; template<> +struct ParamTraits<PP_InputEvent> { + typedef PP_InputEvent param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template<> struct ParamTraits<PP_ObjectProperty> { typedef PP_ObjectProperty param_type; static void Write(Message* m, const param_type& p); diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index cc2f9db..99dcaab 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -65,6 +65,21 @@ void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { instance, has_focus)); } +PP_Bool HandleInputEvent(PP_Instance instance, + const PP_InputEvent* event) { + PP_Bool result = PP_FALSE; + IPC::Message* msg = new PpapiMsg_PPPInstance_HandleInputEvent( + INTERFACE_ID_PPP_INSTANCE, instance, *event, &result); + // Make this message not unblock, to avoid re-entrancy problems when the + // plugin does a synchronous call to the renderer. This will force any + // synchronous calls from the plugin to complete before processing this + // message. We avoid deadlock by never un-setting the unblock flag on messages + // from the plugin to the renderer. + msg->set_unblock(false); + HostDispatcher::GetForInstance(instance)->Send(msg); + return result; +} + PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) { PP_Bool result = PP_FALSE; @@ -97,11 +112,12 @@ PP_Bool HandleDocumentLoad(PP_Instance instance, return result; } -static const PPP_Instance_1_0 instance_interface_1_0 = { +static const PPP_Instance_0_5 instance_interface_0_5 = { &DidCreate, &DidDestroy, &DidChangeView, &DidChangeFocus, + &HandleInputEvent, &HandleDocumentLoad }; @@ -119,13 +135,13 @@ PPP_Instance_Proxy::~PPP_Instance_Proxy() { } // static -const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() { +const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo0_5() { static const Info info = { - &instance_interface_1_0, - PPP_INSTANCE_INTERFACE_1_0, + &instance_interface_0_5, + PPP_INSTANCE_INTERFACE_0_5, INTERFACE_ID_PPP_INSTANCE, false, - &CreateInstanceProxy<PPP_Instance_1_0>, + &CreateInstanceProxy<PPP_Instance_0_5>, }; return &info; } @@ -141,6 +157,8 @@ bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgDidChangeView) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeFocus, OnMsgDidChangeFocus) + IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleInputEvent, + OnMsgHandleInputEvent) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleDocumentLoad, OnMsgHandleDocumentLoad) IPC_MESSAGE_UNHANDLED(handled = false) @@ -206,6 +224,12 @@ void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance, combined_interface_->DidChangeFocus(instance, has_focus); } +void PPP_Instance_Proxy::OnMsgHandleInputEvent(PP_Instance instance, + const PP_InputEvent& event, + PP_Bool* result) { + *result = combined_interface_->HandleInputEvent(instance, &event); +} + void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance, const HostResource& url_loader, PP_Bool* result) { diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h index b246c5c..9448332 100644 --- a/ppapi/proxy/ppp_instance_proxy.h +++ b/ppapi/proxy/ppp_instance_proxy.h @@ -16,6 +16,7 @@ #include "ppapi/proxy/interface_proxy.h" #include "ppapi/shared_impl/ppp_instance_combined.h" +struct PP_InputEvent; struct PP_Rect; namespace pp { @@ -34,8 +35,8 @@ class PPP_Instance_Proxy : public InterfaceProxy { } virtual ~PPP_Instance_Proxy(); - // Return the info for the 1.0 (latest, canonical) version of the interface. - static const Info* GetInfo1_0(); + // Return the info for the 0.5 (latest, canonical) version of the interface. + static const Info* GetInfo0_5(); ::ppapi::PPP_Instance_Combined* ppp_instance_target() const { return combined_interface_.get(); @@ -56,6 +57,9 @@ class PPP_Instance_Proxy : public InterfaceProxy { const PP_Rect& clip, PP_Bool fullscreen); void OnMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); + void OnMsgHandleInputEvent(PP_Instance instance, + const PP_InputEvent& event, + PP_Bool* result); void OnMsgHandleDocumentLoad(PP_Instance instance, const HostResource& url_loader, PP_Bool* result); diff --git a/ppapi/proxy/ppp_instance_proxy_test.cc b/ppapi/proxy/ppp_instance_proxy_test.cc index c49f1a2..00d776b 100644 --- a/ppapi/proxy/ppp_instance_proxy_test.cc +++ b/ppapi/proxy/ppp_instance_proxy_test.cc @@ -60,6 +60,13 @@ void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { did_change_focus_called.Signal(); } +PP_InputEvent received_event; +PP_Bool HandleInputEvent(PP_Instance instance, const PP_InputEvent* event) { + received_instance = instance; + memcpy(&received_event, event, sizeof(*event));; + return bool_to_return; +} + PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) { // This one requires use of the PPB_URLLoader proxy and PPB_Core, plus a // resource tracker for the url_loader resource. @@ -85,13 +92,15 @@ void ResetReceived() { memset(&received_position, 0, sizeof(received_position)); memset(&received_clip, 0, sizeof(received_clip)); received_has_focus = PP_FALSE; + memset(&received_event, 0, sizeof(received_event)); } -PPP_Instance_1_0 ppp_instance_1_0 = { +PPP_Instance_0_5 ppp_instance_0_5 = { &DidCreate, &DidDestroy, &DidChangeView, &DidChangeFocus, + &HandleInputEvent, &HandleDocumentLoad }; @@ -111,15 +120,15 @@ class PPP_Instance_ProxyTest : public TwoWayTest { } }; -TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { - plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0); +TEST_F(PPP_Instance_ProxyTest, PPPInstance0_5) { + plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_5, &ppp_instance_0_5); host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE, &ppb_fullscreen_dev); - // Grab the host-side proxy for the 1.0 interface. - const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( + // Grab the host-side proxy for the 0.5 interface. + const PPP_Instance_0_5* ppp_instance = static_cast<const PPP_Instance_0_5*>( host().host_dispatcher()->GetProxiedInterface( - PPP_INSTANCE_INTERFACE_1_0)); + PPP_INSTANCE_INTERFACE_0_5)); // Call each function in turn, make sure we get the expected values and // returns. @@ -174,6 +183,20 @@ TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { EXPECT_EQ(received_instance, expected_instance); EXPECT_EQ(received_has_focus, expected_has_focus); + PP_InputEvent expected_event = { PP_INPUTEVENT_TYPE_KEYDOWN, // type + 0, // padding + 1.0, // time_stamp + { { 2, 3 } } }; // u (as PP_InputEvent_Key) + ResetReceived(); + EXPECT_EQ(bool_to_return, + ppp_instance->HandleInputEvent(expected_instance, &expected_event)); + EXPECT_EQ(received_instance, expected_instance); + ASSERT_EQ(received_event.type, expected_event.type); + // Ignore padding; it's okay if it's not serialized. + EXPECT_EQ(received_event.time_stamp, expected_event.time_stamp); + EXPECT_EQ(received_event.u.key.modifier, expected_event.u.key.modifier); + EXPECT_EQ(received_event.u.key.key_code, expected_event.u.key.key_code); + // TODO(dmichael): Need to mock out a resource Tracker to be able to test // HandleResourceLoad. It also requires // PPB_Core.AddRefResource and for PPB_URLLoader to be diff --git a/ppapi/shared_impl/ppp_instance_combined.cc b/ppapi/shared_impl/ppp_instance_combined.cc index ffb96a4..ce3d2c4 100644 --- a/ppapi/shared_impl/ppp_instance_combined.cc +++ b/ppapi/shared_impl/ppp_instance_combined.cc @@ -7,20 +7,8 @@ namespace ppapi { PPP_Instance_Combined::PPP_Instance_Combined( - const PPP_Instance_1_0& instance_if) - : PPP_Instance_1_0(instance_if), - HandleInputEvent_0_5(NULL) { -} - -PPP_Instance_Combined::PPP_Instance_Combined( const PPP_Instance_0_5& instance_if) - : PPP_Instance_1_0(), - HandleInputEvent_0_5(instance_if.HandleInputEvent) { - DidCreate = instance_if.DidCreate; - DidDestroy = instance_if.DidDestroy; - DidChangeView = instance_if.DidChangeView; - DidChangeFocus = instance_if.DidChangeFocus; - HandleDocumentLoad = instance_if.HandleDocumentLoad; + : PPP_Instance_0_5(instance_if) { } } // namespace ppapi diff --git a/ppapi/shared_impl/ppp_instance_combined.h b/ppapi/shared_impl/ppp_instance_combined.h index 57b5beb..33548d5 100644 --- a/ppapi/shared_impl/ppp_instance_combined.h +++ b/ppapi/shared_impl/ppp_instance_combined.h @@ -8,51 +8,11 @@ #include "base/basictypes.h" #include "ppapi/c/ppp_instance.h" -// TODO(dmichael): This is here only for temporary backwards compatibility so -// that NaCl and other plugins aren't broken while the change propagates. This -// needs to be deleted in 14, because we don't intend to support PPP_Instance. -// HandleInputEvent. -// --- Begin backwards compatibility code. -union PP_InputEventData { - struct PP_InputEvent_Key key; - struct PP_InputEvent_Character character; - struct PP_InputEvent_Mouse mouse; - struct PP_InputEvent_Wheel wheel; - char padding[64]; -}; -struct PP_InputEvent { - PP_InputEvent_Type type; - int32_t padding; - PP_TimeTicks time_stamp; - union PP_InputEventData u; -}; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); - -#define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" - -struct PPP_Instance_0_5 { - PP_Bool (*DidCreate)(PP_Instance instance, - uint32_t argc, - const char* argn[], - const char* argv[]); - void (*DidDestroy)(PP_Instance instance); - void (*DidChangeView)(PP_Instance instance, - const struct PP_Rect* position, - const struct PP_Rect* clip); - void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); - PP_Bool (*HandleInputEvent)(PP_Instance instance, - const struct PP_InputEvent* event); - PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); -}; -// --- End backwards compatibility code. namespace ppapi { -struct PPP_Instance_Combined : public PPP_Instance_1_0 { +struct PPP_Instance_Combined : public PPP_Instance_0_5 { public: - explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if); explicit PPP_Instance_Combined(const PPP_Instance_0_5& instance_if); - PP_Bool (*HandleInputEvent_0_5)(PP_Instance instance, - const struct PP_InputEvent* event); DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined); }; diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 0bfa05eb3..e253641 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -19,8 +19,8 @@ // crbug.com/74951 #include "content/renderer/p2p/ipc_network_manager.h" #include "content/renderer/p2p/ipc_socket_factory.h" +#include "ppapi/c/pp_input_event.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/input_event.h" #include "ppapi/cpp/rect.h" // TODO(wez): Remove this when crbug.com/86353 is complete. #include "ppapi/cpp/private/var_private.h" @@ -55,8 +55,6 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) : pp::InstancePrivate(pp_instance), initialized_(false), logger_(this) { - RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); - RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); } ChromotingInstance::~ChromotingInstance() { @@ -171,51 +169,44 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position, view_->SetScreenSize(clip.width(), clip.height()); } -bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { +bool ChromotingInstance::HandleInputEvent(const PP_InputEvent& event) { DCHECK(CurrentlyOnPluginThread()); PepperInputHandler* pih = static_cast<PepperInputHandler*>(input_handler_.get()); - switch (event.GetType()) { - case PP_INPUTEVENT_TYPE_MOUSEDOWN: { - pih->HandleMouseButtonEvent(true, pp::MouseInputEvent(event)); + switch (event.type) { + case PP_INPUTEVENT_TYPE_MOUSEDOWN: + pih->HandleMouseButtonEvent(true, event.u.mouse); return true; - } - case PP_INPUTEVENT_TYPE_MOUSEUP: { - pih->HandleMouseButtonEvent(false, pp::MouseInputEvent(event)); + case PP_INPUTEVENT_TYPE_MOUSEUP: + pih->HandleMouseButtonEvent(false, event.u.mouse); return true; - } case PP_INPUTEVENT_TYPE_MOUSEMOVE: case PP_INPUTEVENT_TYPE_MOUSEENTER: - case PP_INPUTEVENT_TYPE_MOUSELEAVE: { - pih->HandleMouseMoveEvent(pp::MouseInputEvent(event)); + case PP_INPUTEVENT_TYPE_MOUSELEAVE: + pih->HandleMouseMoveEvent(event.u.mouse); return true; - } - case PP_INPUTEVENT_TYPE_CONTEXTMENU: { + case PP_INPUTEVENT_TYPE_CONTEXTMENU: // We need to return true here or else we'll get a local (plugin) context // menu instead of the mouseup event for the right click. return true; - } case PP_INPUTEVENT_TYPE_KEYDOWN: - case PP_INPUTEVENT_TYPE_KEYUP: { - pp::KeyboardInputEvent key_event(event); + case PP_INPUTEVENT_TYPE_KEYUP: logger_.VLog(3, "PP_INPUTEVENT_TYPE_KEY%s key=%d", - (event.GetType()==PP_INPUTEVENT_TYPE_KEYDOWN ? "DOWN" : "UP"), - key_event.GetKeyCode()); - pih->HandleKeyEvent(event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN, - key_event); + (event.type==PP_INPUTEVENT_TYPE_KEYDOWN ? "DOWN" : "UP"), + event.u.key.key_code); + pih->HandleKeyEvent(event.type == PP_INPUTEVENT_TYPE_KEYDOWN, + event.u.key); return true; - } - case PP_INPUTEVENT_TYPE_CHAR: { - pih->HandleCharacterEvent(pp::KeyboardInputEvent(event)); + case PP_INPUTEVENT_TYPE_CHAR: + pih->HandleCharacterEvent(event.u.character); return true; - } default: break; diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 6d999c7..d79254f 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -23,13 +23,13 @@ #include "remoting/protocol/connection_to_host.h" class MessageLoop; +struct PP_InputEvent; namespace base { class Thread; } // namespace base namespace pp { -class InputEvent; class Module; } // namespace pp @@ -64,7 +64,7 @@ class ChromotingInstance : public pp::InstancePrivate { virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); virtual void Connect(const ClientConfig& config); - virtual bool HandleInputEvent(const pp::InputEvent& event); + virtual bool HandleInputEvent(const PP_InputEvent& event); virtual void Disconnect(); virtual pp::Var GetInstanceObject(); diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc index f94a402..452668e 100644 --- a/remoting/client/plugin/pepper_input_handler.cc +++ b/remoting/client/plugin/pepper_input_handler.cc @@ -5,15 +5,11 @@ #include "remoting/client/plugin/pepper_input_handler.h" #include "ppapi/c/pp_input_event.h" -#include "ppapi/cpp/input_event.h" -#include "ppapi/cpp/point.h" #include "remoting/client/chromoting_view.h" #include "ui/gfx/point.h" namespace remoting { -using pp::KeyboardInputEvent; -using pp::MouseInputEvent; using protocol::KeyEvent; using protocol::MouseEvent; @@ -30,31 +26,33 @@ void PepperInputHandler::Initialize() { } void PepperInputHandler::HandleKeyEvent(bool keydown, - const KeyboardInputEvent& event) { - SendKeyEvent(keydown, event.GetKeyCode()); + const PP_InputEvent_Key& event) { + SendKeyEvent(keydown, event.key_code); } -void PepperInputHandler::HandleCharacterEvent(const KeyboardInputEvent& event) { +void PepperInputHandler::HandleCharacterEvent( + const PP_InputEvent_Character& event) { // TODO(garykac): Coordinate key and char events. } -void PepperInputHandler::HandleMouseMoveEvent(const MouseInputEvent& event) { - gfx::Point p(static_cast<int>(event.GetMousePosition().x()), - static_cast<int>(event.GetMousePosition().y())); +void PepperInputHandler::HandleMouseMoveEvent( + const PP_InputEvent_Mouse& event) { + gfx::Point p(static_cast<int>(event.x), static_cast<int>(event.y)); // Pepper gives co-ordinates in the plugin instance's co-ordinate system, // which may be different from the host desktop's co-ordinate system. p = view_->ConvertScreenToHost(p); SendMouseMoveEvent(p.x(), p.y()); } -void PepperInputHandler::HandleMouseButtonEvent(bool button_down, - const MouseInputEvent& event) { +void PepperInputHandler::HandleMouseButtonEvent( + bool button_down, + const PP_InputEvent_Mouse& event) { MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED; - if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { + if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { button = MouseEvent::BUTTON_LEFT; - } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { + } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { button = MouseEvent::BUTTON_MIDDLE; - } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { + } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { button = MouseEvent::BUTTON_RIGHT; } diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h index 5a19f88..b99dd32 100644 --- a/remoting/client/plugin/pepper_input_handler.h +++ b/remoting/client/plugin/pepper_input_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -11,11 +11,6 @@ struct PP_InputEvent_Character; struct PP_InputEvent_Key; struct PP_InputEvent_Mouse; -namespace pp { -class KeyboardInputEvent; -class MouseInputEvent; -} // namespace pp - namespace remoting { class PepperInputHandler : public InputHandler { @@ -27,12 +22,12 @@ class PepperInputHandler : public InputHandler { virtual void Initialize(); - void HandleKeyEvent(bool keydown, const pp::KeyboardInputEvent& event); - void HandleCharacterEvent(const pp::KeyboardInputEvent& event); + void HandleKeyEvent(bool keydown, const PP_InputEvent_Key& event); + void HandleCharacterEvent(const PP_InputEvent_Character& event); - void HandleMouseMoveEvent(const pp::MouseInputEvent& event); + void HandleMouseMoveEvent(const PP_InputEvent_Mouse& event); void HandleMouseButtonEvent(bool button_down, - const pp::MouseInputEvent& event); + const PP_InputEvent_Mouse& event); private: DISALLOW_COPY_AND_ASSIGN(PepperInputHandler); diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc index d09faef..41db456c 100644 --- a/webkit/plugins/ppapi/event_conversion.cc +++ b/webkit/plugins/ppapi/event_conversion.cc @@ -13,8 +13,6 @@ #include "base/utf_string_conversion_utils.h" #include "ppapi/c/pp_input_event.h" #include "ppapi/shared_impl/input_event_impl.h" -// TODO(dmichael): Remove this include when PP_InputEvent is gone from m14. -#include "ppapi/shared_impl/ppp_instance_combined.h" #include "ppapi/shared_impl/time_conversion.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "webkit/plugins/ppapi/common.h" diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index e0190c8..a3f7919 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -73,10 +73,6 @@ #include "ppapi/c/trusted/ppb_file_io_trusted.h" #include "ppapi/c/trusted/ppb_image_data_trusted.h" #include "ppapi/c/trusted/ppb_url_loader_trusted.h" -#include "ppapi/shared_impl/input_event_impl.h" -// TODO(dmichael): Delete this include after PPP_Instance_0_5 goes away in m14. -// This is just to get the PPP_INSTANCE_0_5 definition. -#include "ppapi/shared_impl/ppp_instance_combined.h" #include "ppapi/shared_impl/time_conversion.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/thunk.h" @@ -536,11 +532,8 @@ PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { PluginInstance* instance(NULL); - const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0); + const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5); if (ppp_instance) { - instance = PluginInstance::Create1_0(delegate, this, ppp_instance); - } else if ((ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5))) { - // TODO(dmichael): Remove support for 0.5 in m14. instance = PluginInstance::Create0_5(delegate, this, ppp_instance); } if (!instance) { diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 8bc4e62..3163a1c 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -200,18 +200,6 @@ PluginInstance* PluginInstance::Create0_5(PluginDelegate* delegate, new ::ppapi::PPP_Instance_Combined(*interface)); } -// static -PluginInstance* PluginInstance::Create1_0(PluginDelegate* delegate, - PluginModule* module, - const void* ppp_instance_if_1_0) { - const PPP_Instance_1_0* interface = - static_cast<const PPP_Instance_1_0*>(ppp_instance_if_1_0); - return new PluginInstance( - delegate, - module, - new ::ppapi::PPP_Instance_Combined(*interface)); -} - PluginInstance::PluginInstance( PluginDelegate* delegate, PluginModule* module, @@ -431,16 +419,16 @@ bool PluginInstance::Initialize(WebPluginContainer* container, argc++; } - return PP_ToBool(instance_interface_->DidCreate(pp_instance(), - argc, - argn.get(), - argv.get())); + return PPBoolToBool(instance_interface_->DidCreate(pp_instance(), + argc, + argn.get(), + argv.get())); } bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) { Resource::ScopedResourceId resource(loader); - return PP_ToBool(instance_interface_->HandleDocumentLoad(pp_instance(), - resource.id)); + return PPBoolToBool(instance_interface_->HandleDocumentLoad(pp_instance(), + resource.id)); } bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, @@ -471,7 +459,7 @@ bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, new PPB_InputEvent_Impl(this, events[i])); PP_Resource resource = event_resource->GetReference(); - rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( + rv |= PPBoolToBool(plugin_input_event_interface_->HandleInputEvent( pp_instance(), event_resource->GetReference())); // Release the reference we took above. @@ -480,19 +468,15 @@ bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, } } - // For compatibility, also send all input events through the old interface, - // if it exists. + // For compatibility, also send all input events through the old interface. // TODO(brettw) remove this. - if (instance_interface_->HandleInputEvent_0_5) { - std::vector<PP_InputEvent> pp_events; - CreatePPEvent(event, &pp_events); - - // Each input event may generate more than one PP_InputEvent. - for (size_t i = 0; i < pp_events.size(); i++) { - rv |= PP_ToBool( - instance_interface_->HandleInputEvent_0_5(pp_instance(), - &pp_events[i])); - } + std::vector<PP_InputEvent> pp_events; + CreatePPEvent(event, &pp_events); + + // Each input event may generate more than one PP_InputEvent. + for (size_t i = 0; i < pp_events.size(); i++) { + rv |= PPBoolToBool(instance_interface_->HandleInputEvent(pp_instance(), + &pp_events[i])); } if (cursor_.get()) @@ -549,7 +533,7 @@ void PluginInstance::SetWebKitFocus(bool has_focus) { if (PluginHasFocus() != old_plugin_focus) { delegate()->PluginFocusChanged(PluginHasFocus()); instance_interface_->DidChangeFocus(pp_instance(), - PP_FromBool(PluginHasFocus())); + BoolToPPBool(PluginHasFocus())); } } @@ -561,7 +545,7 @@ void PluginInstance::SetContentAreaFocus(bool has_focus) { has_content_area_focus_ = has_focus; if (PluginHasFocus() != old_plugin_focus) { instance_interface_->DidChangeFocus(pp_instance(), - PP_FromBool(PluginHasFocus())); + BoolToPPBool(PluginHasFocus())); } } @@ -621,7 +605,7 @@ string16 PluginInstance::GetSelectedText(bool html) { return string16(); PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), - PP_FromBool(html)); + BoolToPPBool(html)); scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. if (!string) @@ -651,7 +635,7 @@ void PluginInstance::Zoom(double factor, bool text_only) { scoped_refptr<PluginInstance> ref(this); if (!LoadZoomInterface()) return; - plugin_zoom_interface_->Zoom(pp_instance(), factor, PP_FromBool(text_only)); + plugin_zoom_interface_->Zoom(pp_instance(), factor, BoolToPPBool(text_only)); } bool PluginInstance::StartFind(const string16& search_text, @@ -662,11 +646,11 @@ bool PluginInstance::StartFind(const string16& search_text, if (!LoadFindInterface()) return false; find_identifier_ = identifier; - return PP_ToBool( + return PPBoolToBool( plugin_find_interface_->StartFind( pp_instance(), UTF16ToUTF8(search_text.c_str()).c_str(), - PP_FromBool(case_sensitive))); + BoolToPPBool(case_sensitive))); } void PluginInstance::SelectFindResult(bool forward) { @@ -674,7 +658,7 @@ void PluginInstance::SelectFindResult(bool forward) { scoped_refptr<PluginInstance> ref(this); if (LoadFindInterface()) plugin_find_interface_->SelectFindResult(pp_instance(), - PP_FromBool(forward)); + BoolToPPBool(forward)); } void PluginInstance::StopFind() { @@ -1518,7 +1502,7 @@ PP_Bool PluginInstance::SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { // TODO(yzshen): Re-enable it once fullscreen mode is supported on Windows. #if !defined(OS_WIN) - SetFullscreen(PP_ToBool(fullscreen), true); + SetFullscreen(PPBoolToBool(fullscreen), true); return PP_TRUE; #else return PP_FALSE; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index a69c54a..c122ada 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -86,17 +86,11 @@ class PluginInstance : public base::RefCounted<PluginInstance>, public ::ppapi::thunk::PPB_Instance_FunctionAPI, public ::ppapi::InstanceImpl { public: - // TODO(dmichael): Delete this for m14. // Create and return a PluginInstance object which supports the // PPP_Instance_0_5 interface. static PluginInstance* Create0_5(PluginDelegate* delegate, PluginModule* module, const void* ppp_instance_if_0_5); - // Create and return a PluginInstance object which supports the - // PPP_Instance_0_5 interface. - static PluginInstance* Create1_0(PluginDelegate* delegate, - PluginModule* module, - const void* ppp_instance_if_1_0); // Delete should be called by the WebPlugin before this destructor. virtual ~PluginInstance(); diff --git a/webkit/plugins/ppapi/ppapi_unittest.cc b/webkit/plugins/ppapi/ppapi_unittest.cc index ef083998..03a9793 100644 --- a/webkit/plugins/ppapi/ppapi_unittest.cc +++ b/webkit/plugins/ppapi/ppapi_unittest.cc @@ -61,6 +61,7 @@ static PPP_Instance mock_instance_interface = { &Instance_DidDestroy, &Instance_DidChangeView, &Instance_DidChangeFocus, + &Instance_HandleInputEvent, &Instance_HandleDocumentLoad }; @@ -89,10 +90,10 @@ void PpapiUnittest::SetUp() { ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points)); // Initialize the mock instance. - instance_ = PluginInstance::Create1_0( + instance_ = PluginInstance::Create0_5( delegate_.get(), module(), - GetMockInterface(PPP_INSTANCE_INTERFACE_1_0)); + GetMockInterface(PPP_INSTANCE_INTERFACE_0_5)); } @@ -102,7 +103,7 @@ void PpapiUnittest::TearDown() { } const void* PpapiUnittest::GetMockInterface(const char* interface_name) const { - if (strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_0) == 0) + if (strcmp(interface_name, PPP_INSTANCE_INTERFACE_0_5) == 0) return &mock_instance_interface; return NULL; } diff --git a/webkit/plugins/ppapi/resource_tracker_unittest.cc b/webkit/plugins/ppapi/resource_tracker_unittest.cc index 75ea9983..e73b243 100644 --- a/webkit/plugins/ppapi/resource_tracker_unittest.cc +++ b/webkit/plugins/ppapi/resource_tracker_unittest.cc @@ -141,8 +141,8 @@ TEST_F(ResourceTrackerTest, Ref) { TEST_F(ResourceTrackerTest, DeleteResourceWithInstance) { // Make a second instance (the test harness already creates & manages one). scoped_refptr<PluginInstance> instance2( - PluginInstance::Create1_0(delegate(), module(), - GetMockInterface(PPP_INSTANCE_INTERFACE_1_0))); + PluginInstance::Create0_5(delegate(), module(), + GetMockInterface(PPP_INSTANCE_INTERFACE_0_5))); PP_Instance pp_instance2 = instance2->pp_instance(); // Make two resources and take refs on behalf of the "plugin" for each. @@ -175,8 +175,8 @@ TEST_F(ResourceTrackerTest, DeleteResourceWithInstance) { TEST_F(ResourceTrackerTest, DeleteObjectVarWithInstance) { // Make a second instance (the test harness already creates & manages one). scoped_refptr<PluginInstance> instance2( - PluginInstance::Create1_0(delegate(), module(), - GetMockInterface(PPP_INSTANCE_INTERFACE_1_0))); + PluginInstance::Create0_5(delegate(), module(), + GetMockInterface(PPP_INSTANCE_INTERFACE_0_5))); PP_Instance pp_instance2 = instance2->pp_instance(); // Make an object var. |