summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 14:49:32 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 14:49:32 +0000
commit8cef2068010fa12968211e3721d60d4d5fd3d4e9 (patch)
tree63907b7fd8fc28fd2d9a343772edb66a79a4d19a /webkit/plugins
parent304d682f570f60644c97fea6d86bc303ba6b2ac5 (diff)
downloadchromium_src-8cef2068010fa12968211e3721d60d4d5fd3d4e9.zip
chromium_src-8cef2068010fa12968211e3721d60d4d5fd3d4e9.tar.gz
chromium_src-8cef2068010fa12968211e3721d60d4d5fd3d4e9.tar.bz2
Rename Instance_Trusted to Instance_Private, wire it up in Chrome.
Add C++ InstancePrivate. BUG=None TEST=PPAPI tests Review URL: http://codereview.chromium.org/6871040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc3
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc40
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h9
3 files changed, 44 insertions, 8 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 7e8dc4a..7fc683e 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -55,6 +55,7 @@
#include "ppapi/c/private/ppb_flash_file.h"
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_flash_net_connector.h"
+#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/c/private/ppb_proxy_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
@@ -280,6 +281,8 @@ const void* GetInterface(const char* name) {
return PPB_ImageData_Impl::GetTrustedInterface();
if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0)
return PluginInstance::GetInterface();
+ if (strcmp(name, PPB_INSTANCE_PRIVATE_INTERFACE) == 0)
+ return PluginInstance::GetPrivateInterface();
if (strcmp(name, PPB_MESSAGING_INTERFACE) == 0)
return PluginInstance::GetMessagingInterface();
if (strcmp(name, PPB_PDF_INTERFACE) == 0)
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 78df75b..0d81fa9 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;
}
@@ -741,6 +754,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());
}
@@ -909,7 +928,7 @@ void PluginInstance::StopFind() {
bool PluginInstance::LoadFindInterface() {
if (!plugin_find_interface_) {
plugin_find_interface_ =
- reinterpret_cast<const PPP_Find_Dev*>(module_->GetPluginInterface(
+ static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface(
PPP_FIND_DEV_INTERFACE));
}
@@ -920,7 +939,7 @@ bool PluginInstance::LoadMessagingInterface() {
if (!checked_for_plugin_messaging_interface_) {
checked_for_plugin_messaging_interface_ = true;
plugin_messaging_interface_ =
- reinterpret_cast<const PPP_Messaging*>(module_->GetPluginInterface(
+ static_cast<const PPP_Messaging*>(module_->GetPluginInterface(
PPP_MESSAGING_INTERFACE));
}
@@ -930,7 +949,7 @@ bool PluginInstance::LoadMessagingInterface() {
bool PluginInstance::LoadPdfInterface() {
if (!plugin_pdf_interface_) {
plugin_pdf_interface_ =
- reinterpret_cast<const PPP_Pdf*>(module_->GetPluginInterface(
+ static_cast<const PPP_Pdf*>(module_->GetPluginInterface(
PPP_PDF_INTERFACE));
}
@@ -940,17 +959,26 @@ bool PluginInstance::LoadPdfInterface() {
bool PluginInstance::LoadSelectionInterface() {
if (!plugin_selection_interface_) {
plugin_selection_interface_ =
- reinterpret_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface(
+ static_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface(
PPP_SELECTION_DEV_INTERFACE));
}
return !!plugin_selection_interface_;
}
+bool PluginInstance::LoadPrivateInterface() {
+ if (!plugin_private_interface_) {
+ plugin_private_interface_ = static_cast<const PPP_Instance_Private*>(
+ module_->GetPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE));
+ }
+
+ return !!plugin_private_interface_;
+}
+
bool PluginInstance::LoadZoomInterface() {
if (!plugin_zoom_interface_) {
plugin_zoom_interface_ =
- reinterpret_cast<const PPP_Zoom_Dev*>(module_->GetPluginInterface(
+ static_cast<const PPP_Zoom_Dev*>(module_->GetPluginInterface(
PPP_ZOOM_DEV_INTERFACE));
}
@@ -975,7 +1003,7 @@ bool PluginInstance::GetPreferredPrintOutputFormat(
scoped_refptr<PluginInstance> ref(this);
if (!plugin_print_interface_) {
plugin_print_interface_ =
- reinterpret_cast<const PPP_Printing_Dev*>(module_->GetPluginInterface(
+ static_cast<const PPP_Printing_Dev*>(module_->GetPluginInterface(
PPP_PRINTING_DEV_INTERFACE));
}
if (!plugin_print_interface_)
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index f60dc88..c36419e 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -28,12 +28,14 @@
typedef struct NPObject NPObject;
struct PP_Var;
struct PPB_Instance;
+struct PPB_Instance_Private;
struct PPB_Find_Dev;
struct PPB_Fullscreen_Dev;
struct PPB_Messaging;
struct PPB_Zoom_Dev;
struct PPP_Find_Dev;
struct PPP_Instance;
+struct PPP_Instance_Private;
struct PPP_Messaging;
struct PPP_Pdf;
struct PPP_Selection_Dev;
@@ -82,6 +84,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
~PluginInstance();
static const PPB_Instance* GetInterface();
+ static const PPB_Instance_Private* GetPrivateInterface();
// Returns a pointer to the interface implementing PPB_Find that is
// exposed to the plugin.
@@ -140,7 +143,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// Called when the out-of-process plugin implementing this instance crashed.
void InstanceCrashed();
- // PPB_Instance implementation.
+ // PPB_Instance and PPB_Instance_Private implementation.
PP_Var GetWindowObject();
PP_Var GetOwnerElementObject();
bool BindGraphics(PP_Resource graphics_id);
@@ -153,7 +156,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
const PP_Point* hot_spot);
PP_Var ExecuteScript(PP_Var script, PP_Var* exception);
- // PPP_Instance pass-through.
+ // PPP_Instance and PPP_Instance_Private pass-through.
bool Initialize(WebKit::WebPluginContainer* container,
const std::vector<std::string>& arg_names,
const std::vector<std::string>& arg_values,
@@ -263,6 +266,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
bool LoadMessagingInterface();
bool LoadPdfInterface();
bool LoadSelectionInterface();
+ bool LoadPrivateInterface();
bool LoadZoomInterface();
// Determines if we think the plugin has focus, both content area and webkit
@@ -352,6 +356,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
const PPP_Messaging* plugin_messaging_interface_;
const PPP_Pdf* plugin_pdf_interface_;
const PPP_Selection_Dev* plugin_selection_interface_;
+ const PPP_Instance_Private* plugin_private_interface_;
const PPP_Zoom_Dev* plugin_zoom_interface_;
// A flag to indicate whether we have asked this plugin instance for its