OLD | NEW |
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 | |
34 // Responsible for creating the pending resource hosts, holding their IDs until | 29 // Responsible for creating the pending resource hosts, holding their IDs until |
35 // all of them have been created for a single message, and sending the reply to | 30 // all of them have been created for a single message, and sending the reply to |
36 // say that the hosts have been created. | 31 // say that the hosts have been created. |
37 class PendingHostCreator | 32 class PendingHostCreator |
38 : public base::RefCounted<PendingHostCreator> { | 33 : public base::RefCounted<PendingHostCreator> { |
39 public: | 34 public: |
40 PendingHostCreator(BrowserPpapiHostImpl* host, | 35 PendingHostCreator(BrowserPpapiHostImpl* host, |
41 BrowserMessageFilter* connection, | 36 BrowserMessageFilter* connection, |
42 int routing_id, | 37 int routing_id, |
43 int sequence_id, | 38 int sequence_id, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 80 } |
86 | 81 |
87 PendingHostCreator::~PendingHostCreator() { | 82 PendingHostCreator::~PendingHostCreator() { |
88 connection_->Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( | 83 connection_->Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( |
89 routing_id_, sequence_id_, pending_resource_host_ids_)); | 84 routing_id_, sequence_id_, pending_resource_host_ids_)); |
90 } | 85 } |
91 | 86 |
92 } // namespace | 87 } // namespace |
93 | 88 |
94 PepperRendererConnection::PepperRendererConnection(int render_process_id) | 89 PepperRendererConnection::PepperRendererConnection(int render_process_id) |
95 : BrowserMessageFilter( | 90 : render_process_id_(render_process_id) { |
96 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), | |
97 render_process_id_(render_process_id) { | |
98 // Only give the renderer permission for stable APIs. | 91 // Only give the renderer permission for stable APIs. |
99 in_process_host_.reset(new BrowserPpapiHostImpl(this, | 92 in_process_host_.reset(new BrowserPpapiHostImpl(this, |
100 ppapi::PpapiPermissions(), | 93 ppapi::PpapiPermissions(), |
101 "", | 94 "", |
102 base::FilePath(), | 95 base::FilePath(), |
103 base::FilePath(), | 96 base::FilePath(), |
104 true /* in_process */, | 97 true /* in_process */, |
105 false /* external_plugin */)); | 98 false /* external_plugin */)); |
106 } | 99 } |
107 | 100 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 data.render_process_id = render_process_id_; | 231 data.render_process_id = render_process_id_; |
239 in_process_host_->AddInstance(instance, data); | 232 in_process_host_->AddInstance(instance, data); |
240 } | 233 } |
241 | 234 |
242 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( | 235 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( |
243 PP_Instance instance) { | 236 PP_Instance instance) { |
244 in_process_host_->DeleteInstance(instance); | 237 in_process_host_->DeleteInstance(instance); |
245 } | 238 } |
246 | 239 |
247 } // namespace content | 240 } // namespace content |
OLD | NEW |