| Index: content/renderer/pepper/pepper_helper_impl.cc
|
| ===================================================================
|
| --- content/renderer/pepper/pepper_helper_impl.cc (revision 215615)
|
| +++ content/renderer/pepper/pepper_helper_impl.cc (working copy)
|
| @@ -13,7 +13,6 @@
|
| #include "base/callback.h"
|
| #include "base/command_line.h"
|
| #include "base/files/file_path.h"
|
| -#include "base/files/file_util_proxy.h"
|
| #include "base/logging.h"
|
| #include "base/platform_file.h"
|
| #include "base/strings/string_split.h"
|
| @@ -38,6 +37,7 @@
|
| #include "content/renderer/p2p/socket_dispatcher.h"
|
| #include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
|
| #include "content/renderer/pepper/host_dispatcher_wrapper.h"
|
| +#include "content/renderer/pepper/host_globals.h"
|
| #include "content/renderer/pepper/pepper_broker.h"
|
| #include "content/renderer/pepper/pepper_browser_connection.h"
|
| #include "content/renderer/pepper/pepper_file_system_host.h"
|
| @@ -52,7 +52,6 @@
|
| #include "content/renderer/pepper/plugin_module.h"
|
| #include "content/renderer/pepper/ppb_tcp_socket_private_impl.h"
|
| #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
|
| -#include "content/renderer/pepper/resource_helper.h"
|
| #include "content/renderer/pepper/url_response_info_util.h"
|
| #include "content/renderer/render_thread_impl.h"
|
| #include "content/renderer/render_view_impl.h"
|
| @@ -117,9 +116,9 @@
|
| PepperHelperImpl::PepperHelperImpl(RenderViewImpl* render_view)
|
| : RenderViewObserver(render_view),
|
| render_view_(render_view),
|
| - pepper_browser_connection_(this),
|
| focused_plugin_(NULL),
|
| last_mouse_event_target_(NULL) {
|
| + new PepperBrowserConnection(render_view);
|
| }
|
|
|
| PepperHelperImpl::~PepperHelperImpl() {
|
| @@ -495,7 +494,9 @@
|
| instance->SetContentAreaFocus(render_view_->has_focus());
|
|
|
| if (!instance->module()->IsProxied()) {
|
| - pepper_browser_connection_.DidCreateInProcessInstance(
|
| + PepperBrowserConnection* browser_connection =
|
| + PepperBrowserConnection::Get(render_view_);
|
| + browser_connection->DidCreateInProcessInstance(
|
| instance->pp_instance(),
|
| render_view_->GetRoutingID(),
|
| instance->container()->element().document().url(),
|
| @@ -513,7 +514,9 @@
|
| PluginFocusChanged(instance, false);
|
|
|
| if (!instance->module()->IsProxied()) {
|
| - pepper_browser_connection_.DidDeleteInProcessInstance(
|
| + PepperBrowserConnection* browser_connection =
|
| + PepperBrowserConnection::Get(render_view_);
|
| + browser_connection->DidDeleteInProcessInstance(
|
| instance->pp_instance());
|
| }
|
| }
|
| @@ -523,7 +526,8 @@
|
| PPB_Broker_Impl* client) {
|
| DCHECK(client);
|
|
|
| - PluginModule* plugin_module = ResourceHelper::GetPluginModule(client);
|
| + PluginModule* plugin_module =
|
| + HostGlobals::Get()->GetInstance(client->pp_instance())->module();
|
| if (!plugin_module)
|
| return NULL;
|
|
|
| @@ -557,7 +561,8 @@
|
| if (!client.get())
|
| return;
|
|
|
| - PluginModule* plugin_module = ResourceHelper::GetPluginModule(client.get());
|
| + PluginModule* plugin_module =
|
| + HostGlobals::Get()->GetInstance(client->pp_instance())->module();
|
| if (!plugin_module)
|
| return;
|
|
|
| @@ -565,37 +570,6 @@
|
| broker->OnBrokerPermissionResult(client.get(), result);
|
| }
|
|
|
| -bool PepperHelperImpl::AsyncOpenFile(const base::FilePath& path,
|
| - int pp_open_flags,
|
| - const AsyncOpenFileCallback& callback) {
|
| - int message_id = pending_async_open_files_.Add(
|
| - new AsyncOpenFileCallback(callback));
|
| - return Send(new ViewHostMsg_AsyncOpenPepperFile(
|
| - routing_id(), path, pp_open_flags, message_id));
|
| -}
|
| -
|
| -void PepperHelperImpl::OnAsyncFileOpened(
|
| - base::PlatformFileError error_code,
|
| - IPC::PlatformFileForTransit file_for_transit,
|
| - int message_id) {
|
| - AsyncOpenFileCallback* callback =
|
| - pending_async_open_files_.Lookup(message_id);
|
| - DCHECK(callback);
|
| - pending_async_open_files_.Remove(message_id);
|
| -
|
| - base::PlatformFile file =
|
| - IPC::PlatformFileForTransitToPlatformFile(file_for_transit);
|
| - callback->Run(error_code, base::PassPlatformFile(&file));
|
| - // Make sure we won't leak file handle if the requester has died.
|
| - if (file != base::kInvalidPlatformFileValue) {
|
| - base::FileUtilProxy::Close(
|
| - RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(),
|
| - file,
|
| - base::FileUtilProxy::StatusCallback());
|
| - }
|
| - delete callback;
|
| -}
|
| -
|
| void PepperHelperImpl::OnSetFocus(bool has_focus) {
|
| for (std::set<PepperPluginInstanceImpl*>::iterator i =
|
| active_instances_.begin();
|
| @@ -625,19 +599,6 @@
|
| last_mouse_event_target_ = NULL;
|
| }
|
|
|
| -void PepperHelperImpl::RegisterTCPSocket(
|
| - PPB_TCPSocket_Private_Impl* socket,
|
| - uint32 socket_id) {
|
| - tcp_sockets_.AddWithID(socket, socket_id);
|
| -}
|
| -
|
| -void PepperHelperImpl::UnregisterTCPSocket(uint32 socket_id) {
|
| - // There is no DCHECK(tcp_sockets_.Lookup(socket_id)) because this method
|
| - // can be called before TCPSocketConnect or TCPSocketConnectWithNetAddress.
|
| - if (tcp_sockets_.Lookup(socket_id))
|
| - tcp_sockets_.Remove(socket_id);
|
| -}
|
| -
|
| void PepperHelperImpl::HandleDocumentLoad(
|
| PepperPluginInstanceImpl* instance,
|
| const WebKit::WebURLResponse& response) {
|
| @@ -714,22 +675,10 @@
|
| }
|
|
|
| bool PepperHelperImpl::OnMessageReceived(const IPC::Message& message) {
|
| - if (pepper_browser_connection_.OnMessageReceived(message))
|
| - return true;
|
| -
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(PepperHelperImpl, message)
|
| - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
|
| - OnTCPSocketConnectACK)
|
| - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
|
| - OnTCPSocketSSLHandshakeACK)
|
| - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
|
| - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
|
| - IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetOptionACK,
|
| - OnTCPSocketSetOptionACK)
|
| IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated,
|
| OnPpapiBrokerChannelCreated)
|
| - IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenPepperFile_ACK, OnAsyncFileOpened)
|
| IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerPermissionResult,
|
| OnPpapiBrokerPermissionResult)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| @@ -743,62 +692,13 @@
|
| // it's non-pointer member in RenderViewImpl.
|
| }
|
|
|
| -void PepperHelperImpl::OnTCPSocketConnectACK(
|
| - uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - int32_t result,
|
| - const PP_NetAddress_Private& local_addr,
|
| - const PP_NetAddress_Private& remote_addr) {
|
| - PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| - if (socket)
|
| - socket->OnConnectCompleted(result, local_addr, remote_addr);
|
| - if (result != PP_OK)
|
| - tcp_sockets_.Remove(socket_id);
|
| -}
|
| -
|
| -void PepperHelperImpl::OnTCPSocketSSLHandshakeACK(
|
| - uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - bool succeeded,
|
| - const ppapi::PPB_X509Certificate_Fields& certificate_fields) {
|
| - PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| - if (socket)
|
| - socket->OnSSLHandshakeCompleted(succeeded, certificate_fields);
|
| -}
|
| -
|
| -void PepperHelperImpl::OnTCPSocketReadACK(uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - int32_t result,
|
| - const std::string& data) {
|
| - PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| - if (socket)
|
| - socket->OnReadCompleted(result, data);
|
| -}
|
| -
|
| -void PepperHelperImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - int32_t result) {
|
| - PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| - if (socket)
|
| - socket->OnWriteCompleted(result);
|
| -}
|
| -
|
| -void PepperHelperImpl::OnTCPSocketSetOptionACK(
|
| - uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - int32_t result) {
|
| - PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| - if (socket)
|
| - socket->OnSetOptionCompleted(result);
|
| -}
|
| -
|
| void PepperHelperImpl::DidDataFromWebURLResponse(
|
| PP_Instance pp_instance,
|
| const WebKit::WebURLResponse& response,
|
| int pending_host_id,
|
| const ppapi::URLResponseInfoData& data) {
|
| PepperPluginInstanceImpl* instance =
|
| - ResourceHelper::PPInstanceToPluginInstance(pp_instance);
|
| + HostGlobals::Get()->GetInstance(pp_instance);
|
| if (!instance)
|
| return;
|
|
|
|
|