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

Side by Side Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 605593002: PPAPI: Support sending browser-hosted resources synchronously Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content_browsertests Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/pepper/renderer_ppapi_host_impl.h" 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 234 }
235 235
236 std::string RendererPpapiHostImpl::GetPluginName() const { 236 std::string RendererPpapiHostImpl::GetPluginName() const {
237 return module_->name(); 237 return module_->name();
238 } 238 }
239 239
240 void RendererPpapiHostImpl::SetToExternalPluginHost() { 240 void RendererPpapiHostImpl::SetToExternalPluginHost() {
241 is_external_plugin_host_ = true; 241 is_external_plugin_host_ = true;
242 } 242 }
243 243
244 void RendererPpapiHostImpl::CreateBrowserResourceHosts( 244 int32_t RendererPpapiHostImpl::CreateBrowserResourceHosts(
245 PP_Instance instance, 245 PP_Instance instance,
246 const std::vector<IPC::Message>& nested_msgs, 246 const std::vector<IPC::Message>& nested_msgs,
247 const base::Callback<void(const std::vector<int>&)>& callback) const { 247 const PendingResourceCallback& callback) const {
248 RenderFrame* render_frame = GetRenderFrameForInstance(instance); 248 RenderFrame* render_frame = GetRenderFrameForInstance(instance);
249 PepperBrowserConnection* browser_connection = 249 PepperBrowserConnection* browser_connection =
250 PepperBrowserConnection::Get(render_frame); 250 PepperBrowserConnection::Get(render_frame);
251 if (!browser_connection) { 251 if (!browser_connection) {
252 ppapi::proxy::CompletedBrowserResourceHosts empty;
252 base::MessageLoop::current()->PostTask( 253 base::MessageLoop::current()->PostTask(
253 FROM_HERE, 254 FROM_HERE, base::Bind(callback, empty));
254 base::Bind(callback, std::vector<int>(nested_msgs.size(), 0))); 255 return -1;
255 } else { 256 } else {
256 browser_connection->SendBrowserCreate( 257 return browser_connection->SendBrowserCreate(
257 module_->GetPluginChildId(), instance, nested_msgs, callback); 258 module_->GetPluginChildId(), instance, nested_msgs, callback);
258 } 259 }
259 } 260 }
260 261
261 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const { 262 GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const {
262 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); 263 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
263 if (!instance_object) 264 if (!instance_object)
264 return GURL(); 265 return GURL();
265 266
266 return instance_object->container()->element().document().url(); 267 return instance_object->container()->element().document().url();
267 } 268 }
268 269
270 void RendererPpapiHostImpl::GetAllPendingBrowserHosts(
271 PP_Instance instance,
272 std::vector<ppapi::proxy::CompletedBrowserResourceHosts>* result) {
273 RenderFrame* render_frame = GetRenderFrameForInstance(instance);
274 PepperBrowserConnection* browser_connection =
275 PepperBrowserConnection::Get(render_frame);
276 if (!browser_connection)
277 return;
278 browser_connection->GetAllPendingBrowserHosts(instance,
279 module_->GetPluginChildId(),
280 result);
281 }
282
269 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance( 283 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance(
270 PP_Instance pp_instance) const { 284 PP_Instance pp_instance) const {
271 PepperPluginInstanceImpl* instance = 285 PepperPluginInstanceImpl* instance =
272 HostGlobals::Get()->GetInstance(pp_instance); 286 HostGlobals::Get()->GetInstance(pp_instance);
273 if (!instance) 287 if (!instance)
274 return NULL; 288 return NULL;
275 if (!instance->IsValidInstanceOf(module_)) 289 if (!instance->IsValidInstanceOf(module_))
276 return NULL; 290 return NULL;
277 return instance; 291 return instance;
278 } 292 }
279 293
280 } // namespace content 294 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/renderer_ppapi_host_impl.h ('k') | content/renderer/pepper/resource_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698