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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_renderer_connection.cc

Issue 142923005: Allow MessageFilters to restrict listening to specific message classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" 5 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/browser/browser_child_process_host_impl.h" 9 #include "content/browser/browser_child_process_host_impl.h"
10 #include "content/browser/ppapi_plugin_process_host.h" 10 #include "content/browser/ppapi_plugin_process_host.h"
11 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" 11 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
12 #include "content/common/pepper_renderer_instance_data.h" 12 #include "content/common/pepper_renderer_instance_data.h"
13 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
14 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" 14 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h"
15 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h " 15 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h "
16 #include "content/public/browser/content_browser_client.h" 16 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/common/content_client.h" 17 #include "content/public/common/content_client.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 #include "ppapi/host/resource_host.h" 19 #include "ppapi/host/resource_host.h"
20 #include "ppapi/proxy/ppapi_message_utils.h" 20 #include "ppapi/proxy/ppapi_message_utils.h"
21 #include "ppapi/proxy/ppapi_messages.h" 21 #include "ppapi/proxy/ppapi_messages.h"
22 #include "ppapi/proxy/ppapi_message_utils.h" 22 #include "ppapi/proxy/ppapi_message_utils.h"
23 #include "ppapi/proxy/resource_message_params.h" 23 #include "ppapi/proxy/resource_message_params.h"
24 24
25 namespace content { 25 namespace content {
26 26
27 namespace { 27 namespace {
28 28
29 const uint32 kFilteredMessageClasses[] = {
30 PpapiMsgStart,
31 ViewMsgStart,
32 };
33
29 // Responsible for creating the pending resource hosts, holding their IDs until 34 // Responsible for creating the pending resource hosts, holding their IDs until
30 // all of them have been created for a single message, and sending the reply to 35 // all of them have been created for a single message, and sending the reply to
31 // say that the hosts have been created. 36 // say that the hosts have been created.
32 class PendingHostCreator 37 class PendingHostCreator
33 : public base::RefCounted<PendingHostCreator> { 38 : public base::RefCounted<PendingHostCreator> {
34 public: 39 public:
35 PendingHostCreator(BrowserPpapiHostImpl* host, 40 PendingHostCreator(BrowserPpapiHostImpl* host,
36 BrowserMessageFilter* connection, 41 BrowserMessageFilter* connection,
37 int routing_id, 42 int routing_id,
38 int sequence_id, 43 int sequence_id,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 85 }
81 86
82 PendingHostCreator::~PendingHostCreator() { 87 PendingHostCreator::~PendingHostCreator() {
83 connection_->Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( 88 connection_->Send(new PpapiHostMsg_CreateResourceHostsFromHostReply(
84 routing_id_, sequence_id_, pending_resource_host_ids_)); 89 routing_id_, sequence_id_, pending_resource_host_ids_));
85 } 90 }
86 91
87 } // namespace 92 } // namespace
88 93
89 PepperRendererConnection::PepperRendererConnection(int render_process_id) 94 PepperRendererConnection::PepperRendererConnection(int render_process_id)
90 : render_process_id_(render_process_id) { 95 : BrowserMessageFilter(
96 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)),
97 render_process_id_(render_process_id) {
91 // Only give the renderer permission for stable APIs. 98 // Only give the renderer permission for stable APIs.
92 in_process_host_.reset(new BrowserPpapiHostImpl(this, 99 in_process_host_.reset(new BrowserPpapiHostImpl(this,
93 ppapi::PpapiPermissions(), 100 ppapi::PpapiPermissions(),
94 "", 101 "",
95 base::FilePath(), 102 base::FilePath(),
96 base::FilePath(), 103 base::FilePath(),
97 true /* in_process */, 104 true /* in_process */,
98 false /* external_plugin */)); 105 false /* external_plugin */));
99 } 106 }
100 107
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 data.render_process_id = render_process_id_; 238 data.render_process_id = render_process_id_;
232 in_process_host_->AddInstance(instance, data); 239 in_process_host_->AddInstance(instance, data);
233 } 240 }
234 241
235 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( 242 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance(
236 PP_Instance instance) { 243 PP_Instance instance) {
237 in_process_host_->DeleteInstance(instance); 244 in_process_host_->DeleteInstance(instance);
238 } 245 }
239 246
240 } // namespace content 247 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_message_filter.cc ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698