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

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

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bug in GetAbsolutePath (fixes FlashDRM test failure) Created 7 years, 4 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 | Annotate | Revision Log
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/debug/stack_trace.h"
7 #include "content/browser/browser_child_process_host_impl.h" 8 #include "content/browser/browser_child_process_host_impl.h"
8 #include "content/browser/ppapi_plugin_process_host.h" 9 #include "content/browser/ppapi_plugin_process_host.h"
9 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" 10 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
10 #include "content/common/pepper_renderer_instance_data.h" 11 #include "content/common/pepper_renderer_instance_data.h"
11 #include "content/common/view_messages.h" 12 #include "content/common/view_messages.h"
12 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" 13 #include "content/browser/renderer_host/pepper/pepper_file_ref_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"
20 #include "ppapi/proxy/ppapi_message_utils.h"
19 #include "ppapi/proxy/resource_message_params.h" 21 #include "ppapi/proxy/resource_message_params.h"
22 #include "ppapi/shared_impl/file_ref_detailed_info.h"
20 23
21 namespace content { 24 namespace content {
22 25
23 PepperRendererConnection::PepperRendererConnection(int render_process_id) 26 PepperRendererConnection::PepperRendererConnection(int render_process_id)
24 : render_process_id_(render_process_id) { 27 : render_process_id_(render_process_id) {
25 // Only give the renderer permission for stable APIs. 28 // Only give the renderer permission for stable APIs.
26 in_process_host_.reset(new BrowserPpapiHostImpl(this, 29 in_process_host_.reset(new BrowserPpapiHostImpl(this,
27 ppapi::PpapiPermissions(), 30 ppapi::PpapiPermissions(),
28 "", 31 "",
29 base::FilePath(), 32 base::FilePath(),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 bool* message_was_ok) { 72 bool* message_was_ok) {
70 if (in_process_host_->GetPpapiHost()->OnMessageReceived(msg)) 73 if (in_process_host_->GetPpapiHost()->OnMessageReceived(msg))
71 return true; 74 return true;
72 75
73 bool handled = true; 76 bool handled = true;
74 IPC_BEGIN_MESSAGE_MAP_EX(PepperRendererConnection, msg, *message_was_ok) 77 IPC_BEGIN_MESSAGE_MAP_EX(PepperRendererConnection, msg, *message_was_ok)
75 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostFromHost, 78 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostFromHost,
76 OnMsgCreateResourceHostFromHost) 79 OnMsgCreateResourceHostFromHost)
77 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_GetInfoForRenderer, 80 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_GetInfoForRenderer,
78 OnMsgFileRefGetInfoForRenderer) 81 OnMsgFileRefGetInfoForRenderer)
82 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_SyncGetInfoForRenderer,
83 OnMsgFileRefSyncGetInfoForRenderer)
79 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateInProcessInstance, 84 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateInProcessInstance,
80 OnMsgDidCreateInProcessInstance) 85 OnMsgDidCreateInProcessInstance)
81 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteInProcessInstance, 86 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteInProcessInstance,
82 OnMsgDidDeleteInProcessInstance) 87 OnMsgDidDeleteInProcessInstance)
83 IPC_MESSAGE_UNHANDLED(handled = false) 88 IPC_MESSAGE_UNHANDLED(handled = false)
84 IPC_END_MESSAGE_MAP_EX() 89 IPC_END_MESSAGE_MAP_EX()
85 90
86 return handled; 91 return handled;
87 } 92 }
88 93
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 130
126 Send(new PpapiHostMsg_CreateResourceHostFromHostReply( 131 Send(new PpapiHostMsg_CreateResourceHostFromHostReply(
127 routing_id, params.sequence(), pending_resource_host_id)); 132 routing_id, params.sequence(), pending_resource_host_id));
128 } 133 }
129 134
130 void PepperRendererConnection::OnMsgFileRefGetInfoForRenderer( 135 void PepperRendererConnection::OnMsgFileRefGetInfoForRenderer(
131 int routing_id, 136 int routing_id,
132 int child_process_id, 137 int child_process_id,
133 int32_t sequence, 138 int32_t sequence,
134 const std::vector<PP_Resource>& resources) { 139 const std::vector<PP_Resource>& resources) {
135 std::vector<PP_Resource> out_resources; 140 std::vector<ppapi::FileRef_DetailedInfo> infos;
136 std::vector<PP_FileSystemType> fs_types;
137 std::vector<std::string> file_system_url_specs;
138 std::vector<base::FilePath> external_paths;
139 141
140 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id); 142 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id);
143
144 // If the message is being sent from an in-process plugin, we own the
145 // BrowserPpapiHost.
146 if (!host && child_process_id == 0) {
147 host = in_process_host_.get();
148 }
149
141 if (host) { 150 if (host) {
142 for (size_t i = 0; i < resources.size(); ++i) { 151 for (size_t i = 0; i < resources.size(); ++i) {
143 ppapi::host::ResourceHost* resource_host = 152 ppapi::host::ResourceHost* resource_host =
144 host->GetPpapiHost()->GetResourceHost(resources[i]); 153 host->GetPpapiHost()->GetResourceHost(resources[i]);
145 if (resource_host && resource_host->IsFileRefHost()) { 154 if (resource_host && resource_host->IsFileRefHost()) {
146 PepperFileRefHost* file_ref_host = 155 PepperFileRefHost* file_ref_host =
147 static_cast<PepperFileRefHost*>(resource_host); 156 static_cast<PepperFileRefHost*>(resource_host);
148 out_resources.push_back(resources[i]); 157 ppapi::FileRef_DetailedInfo info;
149 fs_types.push_back(file_ref_host->GetFileSystemType()); 158 info.resource = resources[i];
150 file_system_url_specs.push_back(file_ref_host->GetFileSystemURLSpec()); 159 info.file_system_type = file_ref_host->GetFileSystemType();
151 external_paths.push_back(file_ref_host->GetExternalPath()); 160 info.file_system_url_spec = file_ref_host->GetFileSystemURLSpec();
161 info.external_path = file_ref_host->GetExternalPath();
162 infos.push_back(info);
152 } 163 }
153 } 164 }
154 } 165 }
155 Send(new PpapiHostMsg_FileRef_GetInfoForRendererReply( 166 Send(new PpapiHostMsg_FileRef_GetInfoForRendererReply(
156 routing_id, 167 routing_id,
157 sequence, 168 sequence,
158 out_resources, 169 infos));
159 fs_types, 170 }
160 file_system_url_specs, 171
161 external_paths)); 172 void PepperRendererConnection::OnMsgFileRefSyncGetInfoForRenderer(
173 int child_process_id,
174 const std::vector<PP_Resource>& resources,
175 std::vector<ppapi::FileRef_DetailedInfo>* out_infos) {
176 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id);
177
178 // If the message is being sent from an in-process plugin, we own the
179 // BrowserPpapiHost.
180 if (!host && child_process_id == 0) {
181 host = in_process_host_.get();
182 }
183
184 if (host) {
185 for (size_t i = 0; i < resources.size(); ++i) {
186 ppapi::host::ResourceHost* resource_host =
187 host->GetPpapiHost()->GetResourceHost(resources[i]);
188 if (resource_host && resource_host->IsFileRefHost()) {
189 PepperFileRefHost* file_ref_host =
190 static_cast<PepperFileRefHost*>(resource_host);
191 ppapi::FileRef_DetailedInfo info;
192 info.resource = resources[i];
193 info.file_system_type = file_ref_host->GetFileSystemType();
194 info.file_system_url_spec = file_ref_host->GetFileSystemURLSpec();
195 info.external_path = file_ref_host->GetExternalPath();
196 out_infos->push_back(info);
197 }
198 }
199 }
162 } 200 }
163 201
164 void PepperRendererConnection::OnMsgDidCreateInProcessInstance( 202 void PepperRendererConnection::OnMsgDidCreateInProcessInstance(
165 PP_Instance instance, 203 PP_Instance instance,
166 const PepperRendererInstanceData& instance_data) { 204 const PepperRendererInstanceData& instance_data) {
167 PepperRendererInstanceData data = instance_data; 205 PepperRendererInstanceData data = instance_data;
168 data.render_process_id = render_process_id_; 206 data.render_process_id = render_process_id_;
169 in_process_host_->AddInstance(instance, data); 207 in_process_host_->AddInstance(instance, data);
170 } 208 }
171 209
172 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( 210 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance(
173 PP_Instance instance) { 211 PP_Instance instance) {
174 in_process_host_->DeleteInstance(instance); 212 in_process_host_->DeleteInstance(instance);
175 } 213 }
176 214
177 } // namespace content 215 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698