Chromium Code Reviews| Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| index cd2d59f98e0ac2bcc0aaae92189500244c6b7012..aeb927f7e19e38121f596f14b6325aa704c2b87e 100644 |
| --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| @@ -25,6 +25,8 @@ |
| #include "ppapi/c/ppb_messaging.h" |
| #include "ppapi/c/ppp_instance.h" |
| #include "ppapi/c/ppp_messaging.h" |
| +#include "ppapi/c/private/ppb_instance_private.h" |
| +#include "ppapi/c/private/ppp_instance_private.h" |
| #include "printing/units.h" |
| #include "skia/ext/platform_canvas.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| @@ -213,6 +215,12 @@ const PPB_Instance ppb_instance = { |
| &ExecuteScript, |
| }; |
| +const PPB_Instance_Private ppb_instance_private = { |
| + &GetWindowObject, |
| + &GetOwnerElementObject, |
| + &ExecuteScript |
| +}; |
| + |
| void NumberOfFindResultsChanged(PP_Instance instance_id, |
| int32_t total, |
| PP_Bool final_result) { |
| @@ -405,6 +413,11 @@ const PPB_Messaging* PluginInstance::GetMessagingInterface() { |
| } |
| // static |
| +const PPB_Instance_Private* PluginInstance::GetPrivateInterface() { |
| + return &ppb_instance_private; |
| +} |
| + |
| +// static |
| const PPB_Zoom_Dev* PluginInstance::GetZoomInterface() { |
| return &ppb_zoom; |
| } |
| @@ -739,6 +752,12 @@ void PluginInstance::HandleMessage(PP_Var message) { |
| } |
| PP_Var PluginInstance::GetInstanceObject() { |
| + // Try the private interface first. If it is not supported, we fall back to |
| + // the primary PPP_Instance interface. |
| + // TODO(dmichael): Remove support for PPP_Instance.GetInstanceObject |
| + if (LoadPrivateInterface()) { |
| + return plugin_private_interface_->GetInstanceObject(pp_instance()); |
| + } |
| return instance_interface_->GetInstanceObject(pp_instance()); |
| } |
| @@ -945,6 +964,15 @@ bool PluginInstance::LoadSelectionInterface() { |
| return !!plugin_selection_interface_; |
| } |
| +bool PluginInstance::LoadPrivateInterface() { |
| + if (!plugin_private_interface_) { |
| + plugin_private_interface_ = reinterpret_cast<const PPP_Instance_Private*>( |
|
dmichael (off chromium)
2011/04/18 18:58:16
Note I very nearly used static_cast, but went for
brettw
2011/04/18 21:13:26
static_cast is better. Most of the reinterpret cas
|
| + module_->GetPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE)); |
| + } |
| + |
| + return !!plugin_private_interface_; |
| +} |
| + |
| bool PluginInstance::LoadZoomInterface() { |
| if (!plugin_zoom_interface_) { |
| plugin_zoom_interface_ = |