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

Unified Diff: content/browser/renderer_host/pepper_message_filter.cc

Issue 10696132: Wire up a PPAPI host in content/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
Index: content/browser/renderer_host/pepper_message_filter.cc
diff --git a/content/browser/renderer_host/pepper_message_filter.cc b/content/browser/renderer_host/pepper_message_filter.cc
index d6336aafca57e68791f8e7214d04d0fa7b5548e6..b04a8f94d03d749e66518cdcd031c0d58dc71716 100644
--- a/content/browser/renderer_host/pepper_message_filter.cc
+++ b/content/browser/renderer_host/pepper_message_filter.cc
@@ -76,6 +76,10 @@ PepperMessageFilter::PepperMessageFilter(
: process_type_(type),
process_id_(process_id),
resource_context_(browser_context->GetResourceContext()),
+ permissions_(), // Renderer has no PPAPI permissions,
+ host_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ ppapi_host_(ALLOW_THIS_IN_INITIALIZER_LIST(this), &host_factory_,
+ permissions_),
dmichael (off chromium) 2012/07/09 02:14:46 optional: I would almost rather you did ppapi_host
brettw 2012/07/09 04:41:47 I know what you mean, but I kind of hate pointers
host_resolver_(NULL),
next_socket_id_(1) {
DCHECK(type == RENDERER);
@@ -87,10 +91,15 @@ PepperMessageFilter::PepperMessageFilter(
}
PepperMessageFilter::PepperMessageFilter(ProcessType type,
- net::HostResolver* host_resolver)
+ net::HostResolver* host_resolver,
+ const ppapi::PpapiPermissions& perms)
: process_type_(type),
process_id_(0),
resource_context_(NULL),
+ permissions_(perms),
+ host_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ ppapi_host_(ALLOW_THIS_IN_INITIALIZER_LIST(this), &host_factory_,
+ permissions_),
host_resolver_(host_resolver),
next_socket_id_(1),
incognito_(false) {
@@ -115,6 +124,14 @@ void PepperMessageFilter::OverrideThreadForMessage(
bool PepperMessageFilter::OnMessageReceived(const IPC::Message& msg,
bool* message_was_ok) {
+if (process_type_ == PLUGIN) {
+ // Handle new-style host messages directly from the plugin. Don't allow
+ // renderers to send these messages since they could give more permissions
+ // than the renderer might have.
+ if (ppapi_host_.OnMessageReceived(msg))
+ return true;
+ }
+
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(PepperMessageFilter, msg, *message_was_ok)
IPC_MESSAGE_HANDLER(PepperMsg_GetLocalTimeZoneOffset,

Powered by Google App Engine
This is Rietveld 408576698