Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1003)

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 6871040: Rename Instance_Trusted to Instance_Private, wire it up in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix up based on review comments. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6a0730f640c8bc10afdfe88f60097fffad04ac61 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());
}
@@ -907,7 +926,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));
}
@@ -918,7 +937,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));
}
@@ -928,7 +947,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));
}
@@ -938,17 +957,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));
}
@@ -973,7 +1001,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_)
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698