Chromium Code Reviews| 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 "content/browser/browser_child_process_host_impl.h" | 7 #include "content/browser/browser_child_process_host_impl.h" |
| 8 #include "content/browser/ppapi_plugin_process_host.h" | 8 #include "content/browser/ppapi_plugin_process_host.h" |
| 9 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 9 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
| 10 #include "content/common/pepper_renderer_instance_data.h" | 10 #include "content/common/pepper_renderer_instance_data.h" |
| 11 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
| 12 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" | 12 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" |
| 13 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h " | |
| 13 #include "content/public/browser/content_browser_client.h" | 14 #include "content/public/browser/content_browser_client.h" |
| 14 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
| 15 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
| 16 #include "ppapi/host/resource_host.h" | 17 #include "ppapi/host/resource_host.h" |
| 17 #include "ppapi/proxy/ppapi_message_utils.h" | 18 #include "ppapi/proxy/ppapi_message_utils.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 19 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/proxy/ppapi_message_utils.h" | 20 #include "ppapi/proxy/ppapi_message_utils.h" |
| 20 #include "ppapi/proxy/resource_message_params.h" | 21 #include "ppapi/proxy/resource_message_params.h" |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 const ppapi::proxy::ResourceMessageCallParams& params, | 91 const ppapi::proxy::ResourceMessageCallParams& params, |
| 91 PP_Instance instance, | 92 PP_Instance instance, |
| 92 const std::vector<IPC::Message>& nested_msgs) { | 93 const std::vector<IPC::Message>& nested_msgs) { |
| 93 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id); | 94 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id); |
| 94 | 95 |
| 95 std::vector<int> pending_resource_host_ids(nested_msgs.size(), 0); | 96 std::vector<int> pending_resource_host_ids(nested_msgs.size(), 0); |
| 96 if (!host) { | 97 if (!host) { |
| 97 DLOG(ERROR) << "Invalid plugin process ID."; | 98 DLOG(ERROR) << "Invalid plugin process ID."; |
| 98 } else { | 99 } else { |
| 99 for (size_t i = 0; i < nested_msgs.size(); ++i) { | 100 for (size_t i = 0; i < nested_msgs.size(); ++i) { |
| 101 const IPC::Message& nested_msg = nested_msgs[i]; | |
| 100 // FileRef_CreateExternal is only permitted from the renderer. Because of | 102 // FileRef_CreateExternal is only permitted from the renderer. Because of |
| 101 // this, we handle this message here and not in | 103 // this, we handle this message here and not in |
| 102 // content_browser_pepper_host_factory.cc. | 104 // content_browser_pepper_host_factory.cc. |
| 103 scoped_ptr<ppapi::host::ResourceHost> resource_host; | 105 scoped_ptr<ppapi::host::ResourceHost> resource_host; |
| 104 if (host->IsValidInstance(instance)) { | 106 if (host->IsValidInstance(instance)) { |
| 105 if (nested_msgs[i].type() == PpapiHostMsg_FileRef_CreateExternal::ID) { | 107 if (nested_msg.type() == PpapiHostMsg_FileRef_CreateExternal::ID) { |
| 106 base::FilePath external_path; | 108 base::FilePath external_path; |
| 107 if (ppapi::UnpackMessage<PpapiHostMsg_FileRef_CreateExternal>( | 109 if (ppapi::UnpackMessage<PpapiHostMsg_FileRef_CreateExternal>( |
| 108 nested_msgs[i], &external_path)) { | 110 nested_msg, &external_path)) { |
| 109 resource_host.reset(new PepperFileRefHost( | 111 resource_host.reset(new PepperFileRefHost( |
| 110 host, instance, params.pp_resource(), external_path)); | 112 host, instance, params.pp_resource(), external_path)); |
| 111 } | 113 } |
| 114 } else if (nested_msg.type() == PpapiHostMsg_FileSystem_CreateFromRender er::ID) { | |
|
raymes
2013/10/11 04:02:24
nit: long line
Matt Giuca
2013/10/15 00:25:16
Done.
| |
| 115 std::string root_url; | |
| 116 PP_FileSystemType file_system_type; | |
| 117 if (ppapi::UnpackMessage<PpapiHostMsg_FileSystem_CreateFromRenderer>( | |
| 118 nested_msg, &root_url, &file_system_type)) { | |
| 119 resource_host.reset( | |
| 120 new PepperFileSystemBrowserHost(host, | |
| 121 instance, | |
| 122 params.pp_resource(), | |
| 123 GURL(root_url), | |
| 124 file_system_type)); | |
|
dmichael (off chromium)
2013/10/11 19:21:36
Hmm. This could actually go in to content_browser_
Matt Giuca
2013/10/17 09:17:58
Done (comment).
Actually, I think we really don't
dmichael (off chromium)
2013/10/17 17:36:11
Ah, good point!
| |
| 125 } | |
| 112 } | 126 } |
| 113 } | 127 } |
| 114 | 128 |
| 115 if (!resource_host.get()) { | 129 if (!resource_host.get()) { |
| 116 resource_host = host->GetPpapiHost()->CreateResourceHost( | 130 resource_host = host->GetPpapiHost()->CreateResourceHost( |
| 117 params, instance, nested_msgs[i]); | 131 params, instance, nested_msg); |
| 118 } | 132 } |
| 119 | 133 |
| 120 if (resource_host.get()) { | 134 if (resource_host.get()) { |
| 121 pending_resource_host_ids[i] = | 135 pending_resource_host_ids[i] = |
| 122 host->GetPpapiHost()->AddPendingResourceHost(resource_host.Pass()); | 136 host->GetPpapiHost()->AddPendingResourceHost(resource_host.Pass()); |
| 123 } | 137 } |
| 124 } | 138 } |
| 125 } | 139 } |
| 126 | 140 |
| 127 Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( | 141 Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( |
| 128 routing_id, params.sequence(), pending_resource_host_ids)); | 142 routing_id, params.sequence(), pending_resource_host_ids)); |
| 129 } | 143 } |
| 130 | 144 |
| 131 void PepperRendererConnection::OnMsgDidCreateInProcessInstance( | 145 void PepperRendererConnection::OnMsgDidCreateInProcessInstance( |
| 132 PP_Instance instance, | 146 PP_Instance instance, |
| 133 const PepperRendererInstanceData& instance_data) { | 147 const PepperRendererInstanceData& instance_data) { |
| 134 PepperRendererInstanceData data = instance_data; | 148 PepperRendererInstanceData data = instance_data; |
| 135 data.render_process_id = render_process_id_; | 149 data.render_process_id = render_process_id_; |
| 136 in_process_host_->AddInstance(instance, data); | 150 in_process_host_->AddInstance(instance, data); |
| 137 } | 151 } |
| 138 | 152 |
| 139 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( | 153 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( |
| 140 PP_Instance instance) { | 154 PP_Instance instance) { |
| 141 in_process_host_->DeleteInstance(instance); | 155 in_process_host_->DeleteInstance(instance); |
| 142 } | 156 } |
| 143 | 157 |
| 144 } // namespace content | 158 } // namespace content |
| OLD | NEW |