summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 20:42:06 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 20:42:06 +0000
commit8ddc6b7c44630c67acd9c6b5dceaa1e6cce67431 (patch)
tree6132eb484acd52716648fb444f6790d4934f8d7d /ppapi
parent46a20dedad3c121fa8368641d01962f20b21f79f (diff)
downloadchromium_src-8ddc6b7c44630c67acd9c6b5dceaa1e6cce67431.zip
chromium_src-8ddc6b7c44630c67acd9c6b5dceaa1e6cce67431.tar.gz
chromium_src-8ddc6b7c44630c67acd9c6b5dceaa1e6cce67431.tar.bz2
Pepper: Send dev/canary channel status to plugins.
As part of supporting "dev channel" methods in Pepper APIs, the plugin needs to know whether or not it's running in a channel that supports those methods. This patch plumbs that information through LoadPlugin so it's available by the time get_interface<>() would ever be called. TBR=piman BUG=325403 Review URL: https://codereview.chromium.org/104673003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/interface_list.cc12
-rw-r--r--ppapi/proxy/interface_list.h2
-rw-r--r--ppapi/proxy/plugin_main_nacl.cc2
-rw-r--r--ppapi/proxy/ppapi_messages.h5
-rw-r--r--ppapi/shared_impl/ppapi_nacl_channel_args.cc3
-rw-r--r--ppapi/shared_impl/ppapi_nacl_channel_args.h1
6 files changed, 21 insertions, 4 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 588d354..8b05f7a 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -165,6 +165,7 @@ InterfaceProxy* ProxyFactory(Dispatcher* dispatcher) {
}
base::LazyInstance<PpapiPermissions> g_process_global_permissions;
+base::LazyInstance<bool> g_supports_dev_channel;
} // namespace
@@ -189,7 +190,6 @@ InterfaceList::InterfaceList() {
#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h"
}
-
{
Permission current_required_permission = PERMISSION_DEV;
#include "ppapi/thunk/interfaces_ppb_public_dev.h"
@@ -205,6 +205,8 @@ InterfaceList::InterfaceList() {
#endif // !defined(OS_NACL)
}
+ // TODO(teravest): Add dev channel interfaces here.
+
#undef PROXIED_API
#undef PROXIED_IFACE
@@ -310,6 +312,12 @@ void InterfaceList::SetProcessGlobalPermissions(
g_process_global_permissions.Get() = permissions;
}
+// static
+void InterfaceList::SetSupportsDevChannel(
+ bool supports_dev_channel) {
+ g_supports_dev_channel.Get() = supports_dev_channel;
+}
+
ApiID InterfaceList::GetIDForPPBInterface(const std::string& name) const {
NameToInterfaceInfoMap::const_iterator found =
name_to_browser_info_.find(name);
@@ -340,6 +348,8 @@ const void* InterfaceList::GetInterfaceForPPB(const std::string& name) const {
if (found == name_to_browser_info_.end())
return NULL;
+ // Dev channel checking goes here.
+
if (g_process_global_permissions.Get().HasPermission(
found->second.required_permission))
return found->second.iface;
diff --git a/ppapi/proxy/interface_list.h b/ppapi/proxy/interface_list.h
index bb9ccad..7806417 100644
--- a/ppapi/proxy/interface_list.h
+++ b/ppapi/proxy/interface_list.h
@@ -35,6 +35,8 @@ class InterfaceList {
// using to keep honest plugins honest.
static PPAPI_PROXY_EXPORT void SetProcessGlobalPermissions(
const PpapiPermissions& permissions);
+ static PPAPI_PROXY_EXPORT void SetSupportsDevChannel(
+ bool supports_dev_channel);
// Looks up the ID for the given interface name. Returns API_ID_NONE if
// the interface string is not found.
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index bced108..985deb7 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -214,6 +214,8 @@ void PpapiDispatcher::OnMsgCreateNaClChannel(
// plugin.
ppapi::proxy::InterfaceList::SetProcessGlobalPermissions(
args.permissions);
+ ppapi::proxy::InterfaceList::SetSupportsDevChannel(
+ args.supports_dev_channel);
int32_t error = ::PPP_InitializeModule(
0 /* module */,
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 6352e65..4b4fed8 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -364,9 +364,10 @@ IPC_STRUCT_TRAITS_END()
// These are from the browser to the plugin.
// Loads the given plugin.
-IPC_MESSAGE_CONTROL2(PpapiMsg_LoadPlugin,
+IPC_MESSAGE_CONTROL3(PpapiMsg_LoadPlugin,
base::FilePath /* path */,
- ppapi::PpapiPermissions /* permissions */)
+ ppapi::PpapiPermissions /* permissions */,
+ bool /* supports_dev_channel */)
// Creates a channel to talk to a renderer. The plugin will respond with
// PpapiHostMsg_ChannelCreated.
diff --git a/ppapi/shared_impl/ppapi_nacl_channel_args.cc b/ppapi/shared_impl/ppapi_nacl_channel_args.cc
index 7e20a53..670e4e7 100644
--- a/ppapi/shared_impl/ppapi_nacl_channel_args.cc
+++ b/ppapi/shared_impl/ppapi_nacl_channel_args.cc
@@ -8,7 +8,8 @@ namespace ppapi {
// We must provide explicit definitions of these functions for builds on
// Windows.
-PpapiNaClChannelArgs::PpapiNaClChannelArgs() {
+PpapiNaClChannelArgs::PpapiNaClChannelArgs() : off_the_record(false),
+ supports_dev_channel(false) {
}
PpapiNaClChannelArgs::~PpapiNaClChannelArgs() {
diff --git a/ppapi/shared_impl/ppapi_nacl_channel_args.h b/ppapi/shared_impl/ppapi_nacl_channel_args.h
index 462a3a0..1e4e4d5 100644
--- a/ppapi/shared_impl/ppapi_nacl_channel_args.h
+++ b/ppapi/shared_impl/ppapi_nacl_channel_args.h
@@ -19,6 +19,7 @@ struct PPAPI_SHARED_EXPORT PpapiNaClChannelArgs {
bool off_the_record;
PpapiPermissions permissions;
+ bool supports_dev_channel;
// Switches from the command-line.
std::vector<std::string> switch_names;