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

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

Issue 20777009: A few more cleanups to the pepper code. Dispatch IPCs in the sockets implementations directly by ha… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browsertest 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
« no previous file with comments | « content/renderer/pepper/pepper_helper_impl.h ('k') | content/renderer/pepper/ppb_audio_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/pepper_helper_impl.h" 5 #include "content/renderer/pepper/pepper_helper_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util_proxy.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/platform_file.h" 17 #include "base/platform_file.h"
19 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
20 #include "base/sync_socket.h" 19 #include "base/sync_socket.h"
21 #include "base/time/time.h" 20 #include "base/time/time.h"
22 #include "content/child/child_process.h" 21 #include "content/child/child_process.h"
23 #include "content/child/npapi/webplugin.h" 22 #include "content/child/npapi/webplugin.h"
24 #include "content/common/child_process_messages.h" 23 #include "content/common/child_process_messages.h"
25 #include "content/common/gpu/client/context_provider_command_buffer.h" 24 #include "content/common/gpu/client/context_provider_command_buffer.h"
26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
27 #include "content/common/pepper_messages.h" 26 #include "content/common/pepper_messages.h"
28 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
29 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
30 #include "content/public/common/context_menu_params.h" 29 #include "content/public/common/context_menu_params.h"
31 #include "content/public/common/media_stream_request.h" 30 #include "content/public/common/media_stream_request.h"
32 #include "content/public/common/page_zoom.h" 31 #include "content/public/common/page_zoom.h"
33 #include "content/public/common/referrer.h" 32 #include "content/public/common/referrer.h"
34 #include "content/public/common/webplugininfo.h" 33 #include "content/public/common/webplugininfo.h"
35 #include "content/public/renderer/content_renderer_client.h" 34 #include "content/public/renderer/content_renderer_client.h"
36 #include "content/renderer/gamepad_shared_memory_reader.h" 35 #include "content/renderer/gamepad_shared_memory_reader.h"
37 #include "content/renderer/media/media_stream_dispatcher.h" 36 #include "content/renderer/media/media_stream_dispatcher.h"
38 #include "content/renderer/p2p/socket_dispatcher.h" 37 #include "content/renderer/p2p/socket_dispatcher.h"
39 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" 38 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
40 #include "content/renderer/pepper/host_dispatcher_wrapper.h" 39 #include "content/renderer/pepper/host_dispatcher_wrapper.h"
40 #include "content/renderer/pepper/host_globals.h"
41 #include "content/renderer/pepper/pepper_broker.h" 41 #include "content/renderer/pepper/pepper_broker.h"
42 #include "content/renderer/pepper/pepper_browser_connection.h" 42 #include "content/renderer/pepper/pepper_browser_connection.h"
43 #include "content/renderer/pepper/pepper_file_system_host.h" 43 #include "content/renderer/pepper/pepper_file_system_host.h"
44 #include "content/renderer/pepper/pepper_graphics_2d_host.h" 44 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
45 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" 45 #include "content/renderer/pepper/pepper_hung_plugin_filter.h"
46 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" 46 #include "content/renderer/pepper/pepper_in_process_resource_creation.h"
47 #include "content/renderer/pepper/pepper_in_process_router.h" 47 #include "content/renderer/pepper/pepper_in_process_router.h"
48 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 48 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
49 #include "content/renderer/pepper/pepper_plugin_registry.h" 49 #include "content/renderer/pepper/pepper_plugin_registry.h"
50 #include "content/renderer/pepper/pepper_url_loader_host.h" 50 #include "content/renderer/pepper/pepper_url_loader_host.h"
51 #include "content/renderer/pepper/pepper_webplugin_impl.h" 51 #include "content/renderer/pepper/pepper_webplugin_impl.h"
52 #include "content/renderer/pepper/plugin_module.h" 52 #include "content/renderer/pepper/plugin_module.h"
53 #include "content/renderer/pepper/ppb_tcp_socket_private_impl.h" 53 #include "content/renderer/pepper/ppb_tcp_socket_private_impl.h"
54 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 54 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
55 #include "content/renderer/pepper/resource_helper.h"
56 #include "content/renderer/pepper/url_response_info_util.h" 55 #include "content/renderer/pepper/url_response_info_util.h"
57 #include "content/renderer/render_thread_impl.h" 56 #include "content/renderer/render_thread_impl.h"
58 #include "content/renderer/render_view_impl.h" 57 #include "content/renderer/render_view_impl.h"
59 #include "content/renderer/render_widget_fullscreen_pepper.h" 58 #include "content/renderer/render_widget_fullscreen_pepper.h"
60 #include "content/renderer/webplugin_delegate_proxy.h" 59 #include "content/renderer/webplugin_delegate_proxy.h"
61 #include "ipc/ipc_channel_handle.h" 60 #include "ipc/ipc_channel_handle.h"
62 #include "ipc/ipc_platform_file.h" 61 #include "ipc/ipc_platform_file.h"
63 #include "media/video/capture/video_capture_proxy.h" 62 #include "media/video/capture/video_capture_proxy.h"
64 #include "ppapi/c/dev/pp_video_dev.h" 63 #include "ppapi/c/dev/pp_video_dev.h"
65 #include "ppapi/c/pp_errors.h" 64 #include "ppapi/c/pp_errors.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 RendererPpapiHostImpl::CreateOnModuleForInProcess( 109 RendererPpapiHostImpl::CreateOnModuleForInProcess(
111 module, perms); 110 module, perms);
112 render_view->PpapiPluginCreated(host_impl); 111 render_view->PpapiPluginCreated(host_impl);
113 } 112 }
114 113
115 } // namespace 114 } // namespace
116 115
117 PepperHelperImpl::PepperHelperImpl(RenderViewImpl* render_view) 116 PepperHelperImpl::PepperHelperImpl(RenderViewImpl* render_view)
118 : RenderViewObserver(render_view), 117 : RenderViewObserver(render_view),
119 render_view_(render_view), 118 render_view_(render_view),
120 pepper_browser_connection_(this),
121 focused_plugin_(NULL), 119 focused_plugin_(NULL),
122 last_mouse_event_target_(NULL) { 120 last_mouse_event_target_(NULL) {
121 new PepperBrowserConnection(render_view);
123 } 122 }
124 123
125 PepperHelperImpl::~PepperHelperImpl() { 124 PepperHelperImpl::~PepperHelperImpl() {
126 } 125 }
127 126
128 WebKit::WebPlugin* PepperHelperImpl::CreatePepperWebPlugin( 127 WebKit::WebPlugin* PepperHelperImpl::CreatePepperWebPlugin(
129 const WebPluginInfo& webplugin_info, 128 const WebPluginInfo& webplugin_info,
130 const WebKit::WebPluginParams& params) { 129 const WebKit::WebPluginParams& params) {
131 bool pepper_plugin_was_registered = false; 130 bool pepper_plugin_was_registered = false;
132 scoped_refptr<PluginModule> pepper_module( 131 scoped_refptr<PluginModule> pepper_module(
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 487 }
489 488
490 void PepperHelperImpl::InstanceCreated( 489 void PepperHelperImpl::InstanceCreated(
491 PepperPluginInstanceImpl* instance) { 490 PepperPluginInstanceImpl* instance) {
492 active_instances_.insert(instance); 491 active_instances_.insert(instance);
493 492
494 // Set the initial focus. 493 // Set the initial focus.
495 instance->SetContentAreaFocus(render_view_->has_focus()); 494 instance->SetContentAreaFocus(render_view_->has_focus());
496 495
497 if (!instance->module()->IsProxied()) { 496 if (!instance->module()->IsProxied()) {
498 pepper_browser_connection_.DidCreateInProcessInstance( 497 PepperBrowserConnection* browser_connection =
498 PepperBrowserConnection::Get(render_view_);
499 browser_connection->DidCreateInProcessInstance(
499 instance->pp_instance(), 500 instance->pp_instance(),
500 render_view_->GetRoutingID(), 501 render_view_->GetRoutingID(),
501 instance->container()->element().document().url(), 502 instance->container()->element().document().url(),
502 instance->GetPluginURL()); 503 instance->GetPluginURL());
503 } 504 }
504 } 505 }
505 506
506 void PepperHelperImpl::InstanceDeleted( 507 void PepperHelperImpl::InstanceDeleted(
507 PepperPluginInstanceImpl* instance) { 508 PepperPluginInstanceImpl* instance) {
508 active_instances_.erase(instance); 509 active_instances_.erase(instance);
509 510
510 if (last_mouse_event_target_ == instance) 511 if (last_mouse_event_target_ == instance)
511 last_mouse_event_target_ = NULL; 512 last_mouse_event_target_ = NULL;
512 if (focused_plugin_ == instance) 513 if (focused_plugin_ == instance)
513 PluginFocusChanged(instance, false); 514 PluginFocusChanged(instance, false);
514 515
515 if (!instance->module()->IsProxied()) { 516 if (!instance->module()->IsProxied()) {
516 pepper_browser_connection_.DidDeleteInProcessInstance( 517 PepperBrowserConnection* browser_connection =
518 PepperBrowserConnection::Get(render_view_);
519 browser_connection->DidDeleteInProcessInstance(
517 instance->pp_instance()); 520 instance->pp_instance());
518 } 521 }
519 } 522 }
520 523
521 // If a broker has not already been created for this plugin, creates one. 524 // If a broker has not already been created for this plugin, creates one.
522 PepperBroker* PepperHelperImpl::ConnectToBroker( 525 PepperBroker* PepperHelperImpl::ConnectToBroker(
523 PPB_Broker_Impl* client) { 526 PPB_Broker_Impl* client) {
524 DCHECK(client); 527 DCHECK(client);
525 528
526 PluginModule* plugin_module = ResourceHelper::GetPluginModule(client); 529 PluginModule* plugin_module =
530 HostGlobals::Get()->GetInstance(client->pp_instance())->module();
527 if (!plugin_module) 531 if (!plugin_module)
528 return NULL; 532 return NULL;
529 533
530 scoped_refptr<PepperBroker> broker = 534 scoped_refptr<PepperBroker> broker =
531 static_cast<PepperBroker*>(plugin_module->GetBroker()); 535 static_cast<PepperBroker*>(plugin_module->GetBroker());
532 if (!broker.get()) 536 if (!broker.get())
533 broker = CreateBroker(plugin_module); 537 broker = CreateBroker(plugin_module);
534 538
535 int request_id = pending_permission_requests_.Add( 539 int request_id = pending_permission_requests_.Add(
536 new base::WeakPtr<PPB_Broker_Impl>(client->AsWeakPtr())); 540 new base::WeakPtr<PPB_Broker_Impl>(client->AsWeakPtr()));
(...skipping 13 matching lines...) Expand all
550 void PepperHelperImpl::OnPpapiBrokerPermissionResult(int request_id, 554 void PepperHelperImpl::OnPpapiBrokerPermissionResult(int request_id,
551 bool result) { 555 bool result) {
552 scoped_ptr<base::WeakPtr<PPB_Broker_Impl> > client_ptr( 556 scoped_ptr<base::WeakPtr<PPB_Broker_Impl> > client_ptr(
553 pending_permission_requests_.Lookup(request_id)); 557 pending_permission_requests_.Lookup(request_id));
554 DCHECK(client_ptr.get()); 558 DCHECK(client_ptr.get());
555 pending_permission_requests_.Remove(request_id); 559 pending_permission_requests_.Remove(request_id);
556 base::WeakPtr<PPB_Broker_Impl> client = *client_ptr; 560 base::WeakPtr<PPB_Broker_Impl> client = *client_ptr;
557 if (!client.get()) 561 if (!client.get())
558 return; 562 return;
559 563
560 PluginModule* plugin_module = ResourceHelper::GetPluginModule(client.get()); 564 PluginModule* plugin_module =
565 HostGlobals::Get()->GetInstance(client->pp_instance())->module();
561 if (!plugin_module) 566 if (!plugin_module)
562 return; 567 return;
563 568
564 PepperBroker* broker = static_cast<PepperBroker*>(plugin_module->GetBroker()); 569 PepperBroker* broker = static_cast<PepperBroker*>(plugin_module->GetBroker());
565 broker->OnBrokerPermissionResult(client.get(), result); 570 broker->OnBrokerPermissionResult(client.get(), result);
566 } 571 }
567 572
568 bool PepperHelperImpl::AsyncOpenFile(const base::FilePath& path,
569 int pp_open_flags,
570 const AsyncOpenFileCallback& callback) {
571 int message_id = pending_async_open_files_.Add(
572 new AsyncOpenFileCallback(callback));
573 return Send(new ViewHostMsg_AsyncOpenPepperFile(
574 routing_id(), path, pp_open_flags, message_id));
575 }
576
577 void PepperHelperImpl::OnAsyncFileOpened(
578 base::PlatformFileError error_code,
579 IPC::PlatformFileForTransit file_for_transit,
580 int message_id) {
581 AsyncOpenFileCallback* callback =
582 pending_async_open_files_.Lookup(message_id);
583 DCHECK(callback);
584 pending_async_open_files_.Remove(message_id);
585
586 base::PlatformFile file =
587 IPC::PlatformFileForTransitToPlatformFile(file_for_transit);
588 callback->Run(error_code, base::PassPlatformFile(&file));
589 // Make sure we won't leak file handle if the requester has died.
590 if (file != base::kInvalidPlatformFileValue) {
591 base::FileUtilProxy::Close(
592 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(),
593 file,
594 base::FileUtilProxy::StatusCallback());
595 }
596 delete callback;
597 }
598
599 void PepperHelperImpl::OnSetFocus(bool has_focus) { 573 void PepperHelperImpl::OnSetFocus(bool has_focus) {
600 for (std::set<PepperPluginInstanceImpl*>::iterator i = 574 for (std::set<PepperPluginInstanceImpl*>::iterator i =
601 active_instances_.begin(); 575 active_instances_.begin();
602 i != active_instances_.end(); ++i) 576 i != active_instances_.end(); ++i)
603 (*i)->SetContentAreaFocus(has_focus); 577 (*i)->SetContentAreaFocus(has_focus);
604 } 578 }
605 579
606 void PepperHelperImpl::PageVisibilityChanged(bool is_visible) { 580 void PepperHelperImpl::PageVisibilityChanged(bool is_visible) {
607 for (std::set<PepperPluginInstanceImpl*>::iterator i = 581 for (std::set<PepperPluginInstanceImpl*>::iterator i =
608 active_instances_.begin(); 582 active_instances_.begin();
609 i != active_instances_.end(); ++i) 583 i != active_instances_.end(); ++i)
610 (*i)->PageVisibilityChanged(is_visible); 584 (*i)->PageVisibilityChanged(is_visible);
611 } 585 }
612 586
613 bool PepperHelperImpl::IsPluginFocused() const { 587 bool PepperHelperImpl::IsPluginFocused() const {
614 return focused_plugin_ != NULL; 588 return focused_plugin_ != NULL;
615 } 589 }
616 590
617 void PepperHelperImpl::WillHandleMouseEvent() { 591 void PepperHelperImpl::WillHandleMouseEvent() {
618 // This method is called for every mouse event that the render view receives. 592 // This method is called for every mouse event that the render view receives.
619 // And then the mouse event is forwarded to WebKit, which dispatches it to the 593 // And then the mouse event is forwarded to WebKit, which dispatches it to the
620 // event target. Potentially a Pepper plugin will receive the event. 594 // event target. Potentially a Pepper plugin will receive the event.
621 // In order to tell whether a plugin gets the last mouse event and which it 595 // In order to tell whether a plugin gets the last mouse event and which it
622 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the 596 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the
623 // event, it will notify us via DidReceiveMouseEvent() and set itself as 597 // event, it will notify us via DidReceiveMouseEvent() and set itself as
624 // |last_mouse_event_target_|. 598 // |last_mouse_event_target_|.
625 last_mouse_event_target_ = NULL; 599 last_mouse_event_target_ = NULL;
626 } 600 }
627 601
628 void PepperHelperImpl::RegisterTCPSocket(
629 PPB_TCPSocket_Private_Impl* socket,
630 uint32 socket_id) {
631 tcp_sockets_.AddWithID(socket, socket_id);
632 }
633
634 void PepperHelperImpl::UnregisterTCPSocket(uint32 socket_id) {
635 // There is no DCHECK(tcp_sockets_.Lookup(socket_id)) because this method
636 // can be called before TCPSocketConnect or TCPSocketConnectWithNetAddress.
637 if (tcp_sockets_.Lookup(socket_id))
638 tcp_sockets_.Remove(socket_id);
639 }
640
641 void PepperHelperImpl::HandleDocumentLoad( 602 void PepperHelperImpl::HandleDocumentLoad(
642 PepperPluginInstanceImpl* instance, 603 PepperPluginInstanceImpl* instance,
643 const WebKit::WebURLResponse& response) { 604 const WebKit::WebURLResponse& response) {
644 DCHECK(!instance->document_loader()); 605 DCHECK(!instance->document_loader());
645 606
646 // Create a loader resource host for this load. Note that we have to set 607 // Create a loader resource host for this load. Note that we have to set
647 // the document_loader before issuing the in-process 608 // the document_loader before issuing the in-process
648 // PPP_Instance.HandleDocumentLoad call below, since this may reentrantly 609 // PPP_Instance.HandleDocumentLoad call below, since this may reentrantly
649 // call into the instance and expect it to be valid. 610 // call into the instance and expect it to be valid.
650 RendererPpapiHostImpl* host_impl = instance->module()->renderer_ppapi_host(); 611 RendererPpapiHostImpl* host_impl = instance->module()->renderer_ppapi_host();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 last_mouse_event_target_ = instance; 668 last_mouse_event_target_ = instance;
708 } 669 }
709 670
710 void PepperHelperImpl::SampleGamepads(WebKit::WebGamepads* data) { 671 void PepperHelperImpl::SampleGamepads(WebKit::WebGamepads* data) {
711 if (!gamepad_shared_memory_reader_) 672 if (!gamepad_shared_memory_reader_)
712 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); 673 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader);
713 gamepad_shared_memory_reader_->SampleGamepads(*data); 674 gamepad_shared_memory_reader_->SampleGamepads(*data);
714 } 675 }
715 676
716 bool PepperHelperImpl::OnMessageReceived(const IPC::Message& message) { 677 bool PepperHelperImpl::OnMessageReceived(const IPC::Message& message) {
717 if (pepper_browser_connection_.OnMessageReceived(message))
718 return true;
719
720 bool handled = true; 678 bool handled = true;
721 IPC_BEGIN_MESSAGE_MAP(PepperHelperImpl, message) 679 IPC_BEGIN_MESSAGE_MAP(PepperHelperImpl, message)
722 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
723 OnTCPSocketConnectACK)
724 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
725 OnTCPSocketSSLHandshakeACK)
726 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
727 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
728 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetOptionACK,
729 OnTCPSocketSetOptionACK)
730 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, 680 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated,
731 OnPpapiBrokerChannelCreated) 681 OnPpapiBrokerChannelCreated)
732 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenPepperFile_ACK, OnAsyncFileOpened)
733 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult, 682 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult,
734 OnPpapiBrokerPermissionResult) 683 OnPpapiBrokerPermissionResult)
735 IPC_MESSAGE_UNHANDLED(handled = false) 684 IPC_MESSAGE_UNHANDLED(handled = false)
736 IPC_END_MESSAGE_MAP() 685 IPC_END_MESSAGE_MAP()
737 return handled; 686 return handled;
738 } 687 }
739 688
740 void PepperHelperImpl::OnDestruct() { 689 void PepperHelperImpl::OnDestruct() {
741 // Nothing to do here. Default implementation in RenderViewObserver does 690 // Nothing to do here. Default implementation in RenderViewObserver does
742 // 'delete this' but it's not suitable for PepperHelperImpl because 691 // 'delete this' but it's not suitable for PepperHelperImpl because
743 // it's non-pointer member in RenderViewImpl. 692 // it's non-pointer member in RenderViewImpl.
744 } 693 }
745 694
746 void PepperHelperImpl::OnTCPSocketConnectACK(
747 uint32 plugin_dispatcher_id,
748 uint32 socket_id,
749 int32_t result,
750 const PP_NetAddress_Private& local_addr,
751 const PP_NetAddress_Private& remote_addr) {
752 PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
753 if (socket)
754 socket->OnConnectCompleted(result, local_addr, remote_addr);
755 if (result != PP_OK)
756 tcp_sockets_.Remove(socket_id);
757 }
758
759 void PepperHelperImpl::OnTCPSocketSSLHandshakeACK(
760 uint32 plugin_dispatcher_id,
761 uint32 socket_id,
762 bool succeeded,
763 const ppapi::PPB_X509Certificate_Fields& certificate_fields) {
764 PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
765 if (socket)
766 socket->OnSSLHandshakeCompleted(succeeded, certificate_fields);
767 }
768
769 void PepperHelperImpl::OnTCPSocketReadACK(uint32 plugin_dispatcher_id,
770 uint32 socket_id,
771 int32_t result,
772 const std::string& data) {
773 PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
774 if (socket)
775 socket->OnReadCompleted(result, data);
776 }
777
778 void PepperHelperImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
779 uint32 socket_id,
780 int32_t result) {
781 PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
782 if (socket)
783 socket->OnWriteCompleted(result);
784 }
785
786 void PepperHelperImpl::OnTCPSocketSetOptionACK(
787 uint32 plugin_dispatcher_id,
788 uint32 socket_id,
789 int32_t result) {
790 PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
791 if (socket)
792 socket->OnSetOptionCompleted(result);
793 }
794
795 void PepperHelperImpl::DidDataFromWebURLResponse( 695 void PepperHelperImpl::DidDataFromWebURLResponse(
796 PP_Instance pp_instance, 696 PP_Instance pp_instance,
797 const WebKit::WebURLResponse& response, 697 const WebKit::WebURLResponse& response,
798 int pending_host_id, 698 int pending_host_id,
799 const ppapi::URLResponseInfoData& data) { 699 const ppapi::URLResponseInfoData& data) {
800 PepperPluginInstanceImpl* instance = 700 PepperPluginInstanceImpl* instance =
801 ResourceHelper::PPInstanceToPluginInstance(pp_instance); 701 HostGlobals::Get()->GetInstance(pp_instance);
802 if (!instance) 702 if (!instance)
803 return; 703 return;
804 704
805 RendererPpapiHostImpl* host_impl = instance->module()->renderer_ppapi_host(); 705 RendererPpapiHostImpl* host_impl = instance->module()->renderer_ppapi_host();
806 706
807 if (host_impl->in_process_router()) { 707 if (host_impl->in_process_router()) {
808 // Running in-process, we can just create the resource and call the 708 // Running in-process, we can just create the resource and call the
809 // PPP_Instance function directly. 709 // PPP_Instance function directly.
810 scoped_refptr<ppapi::proxy::URLLoaderResource> loader_resource( 710 scoped_refptr<ppapi::proxy::URLLoaderResource> loader_resource(
811 new ppapi::proxy::URLLoaderResource( 711 new ppapi::proxy::URLLoaderResource(
(...skipping 12 matching lines...) Expand all
824 // Running out-of-process. Initiate an IPC call to notify the plugin 724 // Running out-of-process. Initiate an IPC call to notify the plugin
825 // process. 725 // process.
826 ppapi::proxy::HostDispatcher* dispatcher = 726 ppapi::proxy::HostDispatcher* dispatcher =
827 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance); 727 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance);
828 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 728 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
829 ppapi::API_ID_PPP_INSTANCE, pp_instance, pending_host_id, data)); 729 ppapi::API_ID_PPP_INSTANCE, pp_instance, pending_host_id, data));
830 } 730 }
831 } 731 }
832 732
833 } // namespace content 733 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_helper_impl.h ('k') | content/renderer/pepper/ppb_audio_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698