| 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/resource_message_params.h" | 22 #include "ppapi/proxy/resource_message_params.h" |
| 23 #include "ppapi/proxy/serialized_structs.h" |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 const uint32 kFilteredMessageClasses[] = {PpapiMsgStart, ViewMsgStart, }; | 29 const uint32 kFilteredMessageClasses[] = {PpapiMsgStart, ViewMsgStart, }; |
| 29 | 30 |
| 30 // Responsible for creating the pending resource hosts, holding their IDs until | 31 // Responsible for creating the pending resource hosts, holding their IDs until |
| 31 // all of them have been created for a single message, and sending the reply to | 32 // all of them have been created for a single message, and sending the reply to |
| 32 // say that the hosts have been created. | 33 // say that the hosts have been created. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 75 |
| 75 void PendingHostCreator::AddPendingResourceHost( | 76 void PendingHostCreator::AddPendingResourceHost( |
| 76 size_t index, | 77 size_t index, |
| 77 scoped_ptr<ppapi::host::ResourceHost> resource_host) { | 78 scoped_ptr<ppapi::host::ResourceHost> resource_host) { |
| 78 pending_resource_host_ids_[index] = | 79 pending_resource_host_ids_[index] = |
| 79 host_->GetPpapiHost()->AddPendingResourceHost(resource_host.Pass()); | 80 host_->GetPpapiHost()->AddPendingResourceHost(resource_host.Pass()); |
| 80 } | 81 } |
| 81 | 82 |
| 82 PendingHostCreator::~PendingHostCreator() { | 83 PendingHostCreator::~PendingHostCreator() { |
| 83 connection_->Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( | 84 connection_->Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( |
| 84 routing_id_, sequence_id_, pending_resource_host_ids_)); | 85 routing_id_, ppapi::proxy::CompletedBrowserResourceHosts( |
| 86 sequence_id_, pending_resource_host_ids_))); |
| 85 } | 87 } |
| 86 | 88 |
| 87 } // namespace | 89 } // namespace |
| 88 | 90 |
| 89 PepperRendererConnection::PepperRendererConnection(int render_process_id) | 91 PepperRendererConnection::PepperRendererConnection(int render_process_id) |
| 90 : BrowserMessageFilter(kFilteredMessageClasses, | 92 : BrowserMessageFilter(kFilteredMessageClasses, |
| 91 arraysize(kFilteredMessageClasses)), | 93 arraysize(kFilteredMessageClasses)), |
| 92 render_process_id_(render_process_id) { | 94 render_process_id_(render_process_id) { |
| 93 // Only give the renderer permission for stable APIs. | 95 // Only give the renderer permission for stable APIs. |
| 94 in_process_host_.reset(new BrowserPpapiHostImpl(this, | 96 in_process_host_.reset(new BrowserPpapiHostImpl(this, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 data.render_process_id = render_process_id_; | 230 data.render_process_id = render_process_id_; |
| 229 in_process_host_->AddInstance(instance, data); | 231 in_process_host_->AddInstance(instance, data); |
| 230 } | 232 } |
| 231 | 233 |
| 232 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( | 234 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( |
| 233 PP_Instance instance) { | 235 PP_Instance instance) { |
| 234 in_process_host_->DeleteInstance(instance); | 236 in_process_host_->DeleteInstance(instance); |
| 235 } | 237 } |
| 236 | 238 |
| 237 } // namespace content | 239 } // namespace content |
| OLD | NEW |