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

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

Issue 23462016: Revert 219911 "Pepper: Move FileRef to the "new" resource proxy." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 "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/public/browser/content_browser_client.h" 13 #include "content/public/browser/content_browser_client.h"
14 #include "content/public/common/content_client.h" 14 #include "content/public/common/content_client.h"
15 #include "ipc/ipc_message_macros.h" 15 #include "ipc/ipc_message_macros.h"
16 #include "ppapi/host/resource_host.h" 16 #include "ppapi/host/resource_host.h"
17 #include "ppapi/proxy/ppapi_message_utils.h" 17 #include "ppapi/proxy/ppapi_message_utils.h"
18 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
19 #include "ppapi/proxy/ppapi_message_utils.h"
20 #include "ppapi/proxy/resource_message_params.h" 19 #include "ppapi/proxy/resource_message_params.h"
21 #include "ppapi/shared_impl/file_ref_detailed_info.h"
22 20
23 namespace content { 21 namespace content {
24 22
25 PepperRendererConnection::PepperRendererConnection(int render_process_id) 23 PepperRendererConnection::PepperRendererConnection(int render_process_id)
26 : render_process_id_(render_process_id) { 24 : render_process_id_(render_process_id) {
27 // Only give the renderer permission for stable APIs. 25 // Only give the renderer permission for stable APIs.
28 in_process_host_.reset(new BrowserPpapiHostImpl(this, 26 in_process_host_.reset(new BrowserPpapiHostImpl(this,
29 ppapi::PpapiPermissions(), 27 ppapi::PpapiPermissions(),
30 "", 28 "",
31 base::FilePath(), 29 base::FilePath(),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool* message_was_ok) { 68 bool* message_was_ok) {
71 if (in_process_host_->GetPpapiHost()->OnMessageReceived(msg)) 69 if (in_process_host_->GetPpapiHost()->OnMessageReceived(msg))
72 return true; 70 return true;
73 71
74 bool handled = true; 72 bool handled = true;
75 IPC_BEGIN_MESSAGE_MAP_EX(PepperRendererConnection, msg, *message_was_ok) 73 IPC_BEGIN_MESSAGE_MAP_EX(PepperRendererConnection, msg, *message_was_ok)
76 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostsFromHost, 74 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostsFromHost,
77 OnMsgCreateResourceHostsFromHost) 75 OnMsgCreateResourceHostsFromHost)
78 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_GetInfoForRenderer, 76 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_GetInfoForRenderer,
79 OnMsgFileRefGetInfoForRenderer) 77 OnMsgFileRefGetInfoForRenderer)
80 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_SyncGetInfoForRenderer,
81 OnMsgFileRefSyncGetInfoForRenderer)
82 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateInProcessInstance, 78 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateInProcessInstance,
83 OnMsgDidCreateInProcessInstance) 79 OnMsgDidCreateInProcessInstance)
84 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteInProcessInstance, 80 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteInProcessInstance,
85 OnMsgDidDeleteInProcessInstance) 81 OnMsgDidDeleteInProcessInstance)
86 IPC_MESSAGE_UNHANDLED(handled = false) 82 IPC_MESSAGE_UNHANDLED(handled = false)
87 IPC_END_MESSAGE_MAP_EX() 83 IPC_END_MESSAGE_MAP_EX()
88 84
89 return handled; 85 return handled;
90 } 86 }
91 87
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 127
132 Send(new PpapiHostMsg_CreateResourceHostsFromHostReply( 128 Send(new PpapiHostMsg_CreateResourceHostsFromHostReply(
133 routing_id, params.sequence(), pending_resource_host_ids)); 129 routing_id, params.sequence(), pending_resource_host_ids));
134 } 130 }
135 131
136 void PepperRendererConnection::OnMsgFileRefGetInfoForRenderer( 132 void PepperRendererConnection::OnMsgFileRefGetInfoForRenderer(
137 int routing_id, 133 int routing_id,
138 int child_process_id, 134 int child_process_id,
139 int32_t sequence, 135 int32_t sequence,
140 const std::vector<PP_Resource>& resources) { 136 const std::vector<PP_Resource>& resources) {
141 std::vector<ppapi::FileRefDetailedInfo> infos; 137 std::vector<PP_Resource> out_resources;
142 OnMsgFileRefSyncGetInfoForRenderer(child_process_id, resources, &infos); 138 std::vector<PP_FileSystemType> fs_types;
143 Send(new PpapiHostMsg_FileRef_GetInfoForRendererReply( 139 std::vector<std::string> file_system_url_specs;
144 routing_id, 140 std::vector<base::FilePath> external_paths;
145 sequence,
146 infos));
147 }
148 141
149 void PepperRendererConnection::OnMsgFileRefSyncGetInfoForRenderer(
150 int child_process_id,
151 const std::vector<PP_Resource>& resources,
152 std::vector<ppapi::FileRefDetailedInfo>* out_infos) {
153 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id); 142 BrowserPpapiHostImpl* host = GetHostForChildProcess(child_process_id);
154
155 if (host) { 143 if (host) {
156 for (size_t i = 0; i < resources.size(); ++i) { 144 for (size_t i = 0; i < resources.size(); ++i) {
157 ppapi::host::ResourceHost* resource_host = 145 ppapi::host::ResourceHost* resource_host =
158 host->GetPpapiHost()->GetResourceHost(resources[i]); 146 host->GetPpapiHost()->GetResourceHost(resources[i]);
159 if (resource_host && resource_host->IsFileRefHost()) { 147 if (resource_host && resource_host->IsFileRefHost()) {
160 PepperFileRefHost* file_ref_host = 148 PepperFileRefHost* file_ref_host =
161 static_cast<PepperFileRefHost*>(resource_host); 149 static_cast<PepperFileRefHost*>(resource_host);
162 ppapi::FileRefDetailedInfo info; 150 out_resources.push_back(resources[i]);
163 info.resource = resources[i]; 151 fs_types.push_back(file_ref_host->GetFileSystemType());
164 info.file_system_type = file_ref_host->GetFileSystemType(); 152 file_system_url_specs.push_back(file_ref_host->GetFileSystemURLSpec());
165 info.file_system_url_spec = file_ref_host->GetFileSystemURLSpec(); 153 external_paths.push_back(file_ref_host->GetExternalPath());
166 info.external_path = file_ref_host->GetExternalPath();
167 out_infos->push_back(info);
168 } 154 }
169 } 155 }
170 } 156 }
157 Send(new PpapiHostMsg_FileRef_GetInfoForRendererReply(
158 routing_id,
159 sequence,
160 out_resources,
161 fs_types,
162 file_system_url_specs,
163 external_paths));
171 } 164 }
172 165
173 void PepperRendererConnection::OnMsgDidCreateInProcessInstance( 166 void PepperRendererConnection::OnMsgDidCreateInProcessInstance(
174 PP_Instance instance, 167 PP_Instance instance,
175 const PepperRendererInstanceData& instance_data) { 168 const PepperRendererInstanceData& instance_data) {
176 PepperRendererInstanceData data = instance_data; 169 PepperRendererInstanceData data = instance_data;
177 data.render_process_id = render_process_id_; 170 data.render_process_id = render_process_id_;
178 in_process_host_->AddInstance(instance, data); 171 in_process_host_->AddInstance(instance, data);
179 } 172 }
180 173
181 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance( 174 void PepperRendererConnection::OnMsgDidDeleteInProcessInstance(
182 PP_Instance instance) { 175 PP_Instance instance) {
183 in_process_host_->DeleteInstance(instance); 176 in_process_host_->DeleteInstance(instance);
184 } 177 }
185 178
186 } // namespace content 179 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/renderer_host/pepper/pepper_renderer_connection.h ('k') | trunk/src/content/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698