summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc21
-rw-r--r--content/renderer/pepper/content_renderer_pepper_host_factory.cc14
-rw-r--r--ppapi/proxy/ppp_printing_proxy.cc17
-rw-r--r--webkit/plugins/ppapi/plugin_module.h2
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc3
5 files changed, 39 insertions, 18 deletions
diff --git a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
index eb325fd..b66ff88 100644
--- a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
+++ b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
@@ -34,17 +34,24 @@ scoped_ptr<ResourceHost> ContentBrowserPepperHostFactory::CreateResourceHost(
if (!host_->IsValidInstance(instance))
return scoped_ptr<ResourceHost>();
- // Public interfaces with no permissions required.
+ // Public interfaces.
switch (message.type()) {
case PpapiHostMsg_Gamepad_Create::ID:
return scoped_ptr<ResourceHost>(new PepperGamepadHost(
host_, instance, params.pp_resource()));
- case PpapiHostMsg_Printing_Create::ID: {
- scoped_ptr<PepperPrintSettingsManager> manager(
- new PepperPrintSettingsManagerImpl());
- return scoped_ptr<ResourceHost>(new PepperPrintingHost(
- host_->GetPpapiHost(), instance,
- params.pp_resource(), manager.Pass()));
+ }
+
+ // Dev interfaces.
+ if (host_->GetPpapiHost()->permissions().HasPermission(
+ ppapi::PERMISSION_DEV)) {
+ switch (message.type()) {
+ case PpapiHostMsg_Printing_Create::ID: {
+ scoped_ptr<PepperPrintSettingsManager> manager(
+ new PepperPrintSettingsManagerImpl());
+ return scoped_ptr<ResourceHost>(new PepperPrintingHost(
+ host_->GetPpapiHost(), instance,
+ params.pp_resource(), manager.Pass()));
+ }
}
}
return scoped_ptr<ResourceHost>();
diff --git a/content/renderer/pepper/content_renderer_pepper_host_factory.cc b/content/renderer/pepper/content_renderer_pepper_host_factory.cc
index 65edc2c..db03a34 100644
--- a/content/renderer/pepper/content_renderer_pepper_host_factory.cc
+++ b/content/renderer/pepper/content_renderer_pepper_host_factory.cc
@@ -38,21 +38,15 @@ scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost(
if (!host_->IsValidInstance(instance))
return scoped_ptr<ResourceHost>();
- // Stable interfaces.
+ // Public interfaces.
switch (message.type()) {
case PpapiHostMsg_WebSocket_Create::ID:
return scoped_ptr<ResourceHost>(new PepperWebSocketHost(
host_, instance, params.pp_resource()));
}
- // Resources for dev interfaces.
- // TODO(brettw) when we support any public or private interfaces, put them in
- // a separate switch above.
-
- // TODO(brettw) put back this dev check! This was removed to fix issue 138902
- // where the permissions for bundled Flash (but not Flash that you specify
- // on the command line, making it difficult to test) are incorrect.
- /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ {
+ // Dev interfaces.
+ if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) {
switch (message.type()) {
case PpapiHostMsg_AudioInput_Create::ID:
return scoped_ptr<ResourceHost>(new PepperAudioInputHost(
@@ -72,7 +66,7 @@ scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost(
}
}
- // Resources for Flash interfaces.
+ // Flash interfaces.
if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) {
switch (message.type()) {
case PpapiHostMsg_Flash_Create::ID:
diff --git a/ppapi/proxy/ppp_printing_proxy.cc b/ppapi/proxy/ppp_printing_proxy.cc
index b5d3a3e..2008587 100644
--- a/ppapi/proxy/ppp_printing_proxy.cc
+++ b/ppapi/proxy/ppp_printing_proxy.cc
@@ -19,7 +19,16 @@ namespace proxy {
namespace {
+bool HasPrintingPermission(PP_Instance instance) {
+ Dispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return false;
+ return dispatcher->permissions().HasPermission(PERMISSION_DEV);
+}
+
uint32_t QuerySupportedFormats(PP_Instance instance) {
+ if (!HasPrintingPermission(instance))
+ return 0;
uint32_t result = 0;
HostDispatcher::GetForInstance(instance)->Send(
new PpapiMsg_PPPPrinting_QuerySupportedFormats(API_ID_PPP_PRINTING,
@@ -29,6 +38,8 @@ uint32_t QuerySupportedFormats(PP_Instance instance) {
int32_t Begin(PP_Instance instance,
const struct PP_PrintSettings_Dev* print_settings) {
+ if (!HasPrintingPermission(instance))
+ return 0;
// Settings is just serialized as a string.
std::string settings_string;
settings_string.resize(sizeof(*print_settings));
@@ -44,6 +55,8 @@ int32_t Begin(PP_Instance instance,
PP_Resource PrintPages(PP_Instance instance,
const PP_PrintPageNumberRange_Dev* page_ranges,
uint32_t page_range_count) {
+ if (!HasPrintingPermission(instance))
+ return 0;
std::vector<PP_PrintPageNumberRange_Dev> pages(
page_ranges, page_ranges + page_range_count);
@@ -65,11 +78,15 @@ PP_Resource PrintPages(PP_Instance instance,
}
void End(PP_Instance instance) {
+ if (!HasPrintingPermission(instance))
+ return;
HostDispatcher::GetForInstance(instance)->Send(
new PpapiMsg_PPPPrinting_End(API_ID_PPP_PRINTING, instance));
}
PP_Bool IsScalingDisabled(PP_Instance instance) {
+ if (!HasPrintingPermission(instance))
+ return PP_FALSE;
bool result = false;
HostDispatcher::GetForInstance(instance)->Send(
new PpapiMsg_PPPPrinting_IsScalingDisabled(API_ID_PPP_PRINTING,
diff --git a/webkit/plugins/ppapi/plugin_module.h b/webkit/plugins/ppapi/plugin_module.h
index 0761e2d..0a23714 100644
--- a/webkit/plugins/ppapi/plugin_module.h
+++ b/webkit/plugins/ppapi/plugin_module.h
@@ -133,7 +133,7 @@ class WEBKIT_PLUGINS_EXPORT PluginModule :
const std::string& name() const { return name_; }
const FilePath& path() const { return path_; }
- const ::ppapi::PpapiPermissions permissions() const { return permissions_; }
+ const ::ppapi::PpapiPermissions& permissions() const { return permissions_; }
PluginInstance* CreateInstance(PluginDelegate* delegate);
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 4aa3f99..ea2bbfd 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1109,6 +1109,9 @@ bool PluginInstance::LoadPdfInterface() {
}
bool PluginInstance::LoadPrintInterface() {
+ // Only check for the interface if the plugin has dev permission.
+ if (!module_->permissions().HasPermission(::ppapi::PERMISSION_DEV))
+ return false;
if (!plugin_print_interface_) {
plugin_print_interface_ = static_cast<const PPP_Printing_Dev*>(
module_->GetPluginInterface(PPP_PRINTING_DEV_INTERFACE));