summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/ppapi_plugin/broker_process_dispatcher.cc50
-rw-r--r--content/ppapi_plugin/broker_process_dispatcher.h18
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc36
-rw-r--r--content/ppapi_plugin/ppapi_thread.h10
-rw-r--r--ppapi/proxy/broker_dispatcher.h8
5 files changed, 73 insertions, 49 deletions
diff --git a/content/ppapi_plugin/broker_process_dispatcher.cc b/content/ppapi_plugin/broker_process_dispatcher.cc
index 7cdc0e34..c5f4baa 100644
--- a/content/ppapi_plugin/broker_process_dispatcher.cc
+++ b/content/ppapi_plugin/broker_process_dispatcher.cc
@@ -6,7 +6,10 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/utf_string_conversions.h"
#include "content/common/child_process.h"
+#include "ppapi/c/private/ppp_flash_browser_operations.h"
+#include "ppapi/proxy/ppapi_messages.h"
namespace {
@@ -17,9 +20,11 @@ const int kBrokerReleaseTimeSeconds = 30;
BrokerProcessDispatcher::BrokerProcessDispatcher(
base::ProcessHandle remote_process_handle,
+ PP_GetInterface_Func get_plugin_interface,
PP_ConnectInstance_Func connect_instance)
: ppapi::proxy::BrokerSideDispatcher(remote_process_handle,
- connect_instance) {
+ connect_instance),
+ get_plugin_interface_(get_plugin_interface) {
ChildProcess::current()->AddRefProcess();
}
@@ -36,3 +41,46 @@ BrokerProcessDispatcher::~BrokerProcessDispatcher() {
base::Unretained(ChildProcess::current())),
base::TimeDelta::FromSeconds(kBrokerReleaseTimeSeconds));
}
+
+bool BrokerProcessDispatcher::OnMessageReceived(const IPC::Message& msg) {
+ IPC_BEGIN_MESSAGE_MAP(BrokerProcessDispatcher, msg)
+ IPC_MESSAGE_HANDLER(PpapiMsg_ClearSiteData, OnMsgClearSiteData)
+ IPC_MESSAGE_UNHANDLED(return BrokerSideDispatcher::OnMessageReceived(msg))
+ IPC_END_MESSAGE_MAP()
+ return true;
+}
+
+void BrokerProcessDispatcher::OnMsgClearSiteData(
+ const FilePath& plugin_data_path,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age) {
+ Send(new PpapiHostMsg_ClearSiteDataResult(
+ ClearSiteData(plugin_data_path, site, flags, max_age)));
+}
+
+bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age) {
+ if (!get_plugin_interface_)
+ return false;
+ const PPP_Flash_BrowserOperations_1_0* browser_interface =
+ static_cast<const PPP_Flash_BrowserOperations_1_0*>(
+ get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0));
+ if (!browser_interface)
+ return false;
+
+ // The string is always 8-bit, convert on Windows.
+#if defined(OS_WIN)
+ std::string data_str = WideToUTF8(plugin_data_path.value());
+#else
+ std::string data_str = plugin_data_path.value();
+#endif
+
+ browser_interface->ClearSiteData(data_str.c_str(),
+ site.empty() ? NULL : site.c_str(),
+ flags, max_age);
+ return true;
+}
+
diff --git a/content/ppapi_plugin/broker_process_dispatcher.h b/content/ppapi_plugin/broker_process_dispatcher.h
index adecc97..2232a6a 100644
--- a/content/ppapi_plugin/broker_process_dispatcher.h
+++ b/content/ppapi_plugin/broker_process_dispatcher.h
@@ -6,6 +6,7 @@
#define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_
#include "base/basictypes.h"
+#include "ppapi/c/ppp.h"
#include "ppapi/proxy/broker_dispatcher.h"
// Wrapper around a BrokerDispatcher that provides the necessary integration
@@ -14,10 +15,27 @@
class BrokerProcessDispatcher : public ppapi::proxy::BrokerSideDispatcher {
public:
BrokerProcessDispatcher(base::ProcessHandle remote_process_handle,
+ PP_GetInterface_Func get_plugin_interface,
PP_ConnectInstance_Func connect_instance);
virtual ~BrokerProcessDispatcher();
+ // IPC::Channel::Listener overrides.
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+
private:
+ void OnMsgClearSiteData(const FilePath& plugin_data_path,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age);
+
+ // Requests that the plugin clear data, returning true on success.
+ bool ClearSiteData(const FilePath& plugin_data_path,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age);
+
+ PP_GetInterface_Func get_plugin_interface_;
+
DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher);
};
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 7c45230..da49c12 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -23,7 +23,6 @@
#include "ppapi/c/dev/ppp_network_state_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp.h"
-#include "ppapi/c/private/ppp_flash_browser_operations.h"
#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/interface_list.h"
@@ -85,7 +84,6 @@ bool PpapiThread::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin)
IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel)
- IPC_MESSAGE_HANDLER(PpapiMsg_ClearSiteData, OnMsgClearSiteData)
IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_ListenACK,
OnPluginDispatcherMessageReceived(msg))
@@ -258,14 +256,6 @@ void PpapiThread::OnMsgCreateChannel(base::ProcessHandle host_process_handle,
Send(new PpapiHostMsg_ChannelCreated(channel_handle));
}
-void PpapiThread::OnMsgClearSiteData(const FilePath& plugin_data_path,
- const std::string& site,
- uint64 flags,
- uint64 max_age) {
- Send(new PpapiHostMsg_ClearSiteDataResult(
- ClearSiteData(plugin_data_path, site, flags, max_age)));
-}
-
void PpapiThread::OnMsgSetNetworkState(bool online) {
if (!get_plugin_interface_)
return;
@@ -289,31 +279,6 @@ void PpapiThread::OnPluginDispatcherMessageReceived(const IPC::Message& msg) {
dispatcher->second->OnMessageReceived(msg);
}
-bool PpapiThread::ClearSiteData(const FilePath& plugin_data_path,
- const std::string& site,
- uint64 flags,
- uint64 max_age) {
- if (!get_plugin_interface_)
- return false;
- const PPP_Flash_BrowserOperations_1_0* browser_interface =
- static_cast<const PPP_Flash_BrowserOperations_1_0*>(
- get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0));
- if (!browser_interface)
- return false;
-
- // The string is always 8-bit, convert on Windows.
-#if defined(OS_WIN)
- std::string data_str = WideToUTF8(plugin_data_path.value());
-#else
- std::string data_str = plugin_data_path.value();
-#endif
-
- browser_interface->ClearSiteData(data_str.c_str(),
- site.empty() ? NULL : site.c_str(),
- flags, max_age);
- return true;
-}
-
bool PpapiThread::SetupRendererChannel(base::ProcessHandle host_process_handle,
int renderer_id,
IPC::ChannelHandle* handle) {
@@ -327,6 +292,7 @@ bool PpapiThread::SetupRendererChannel(base::ProcessHandle host_process_handle,
if (is_broker_) {
BrokerProcessDispatcher* broker_dispatcher =
new BrokerProcessDispatcher(host_process_handle,
+ get_plugin_interface_,
connect_instance_func_);
init_result = broker_dispatcher->InitBrokerWithChannel(this,
plugin_handle,
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index dfd23ab..6cd0eb0 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -56,19 +56,9 @@ class PpapiThread : public ChildThread,
void OnMsgLoadPlugin(const FilePath& path);
void OnMsgCreateChannel(base::ProcessHandle host_process_handle,
int renderer_id);
- void OnMsgClearSiteData(const FilePath& plugin_data_path,
- const std::string& site,
- uint64 flags,
- uint64 max_age);
void OnMsgSetNetworkState(bool online);
void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
- // Requests that the plugin clear data, returning true on success.
- bool ClearSiteData(const FilePath& plugin_data_path,
- const std::string& site,
- uint64 flags,
- uint64 max_age);
-
// Sets up the channel to the given renderer. On success, returns true and
// fills the given ChannelHandle with the information from the new channel.
bool SetupRendererChannel(base::ProcessHandle host_process_handle,
diff --git a/ppapi/proxy/broker_dispatcher.h b/ppapi/proxy/broker_dispatcher.h
index 126b82c..f325858 100644
--- a/ppapi/proxy/broker_dispatcher.h
+++ b/ppapi/proxy/broker_dispatcher.h
@@ -4,7 +4,9 @@
#ifndef PPAPI_PROXY_BROKER_DISPATCHER_H_
#define PPAPI_PROXY_BROKER_DISPATCHER_H_
+#pragma once
+#include "base/compiler_specific.h"
#include "ppapi/c/trusted/ppp_broker.h"
#include "ppapi/proxy/proxy_channel.h"
@@ -23,7 +25,7 @@ class PPAPI_PROXY_EXPORT BrokerDispatcher : public ProxyChannel {
bool is_client);
// IPC::Channel::Listener implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
protected:
// You must call InitBrokerWithChannel after the constructor.
@@ -46,7 +48,7 @@ class PPAPI_PROXY_EXPORT BrokerHostDispatcher : public BrokerDispatcher {
BrokerHostDispatcher(base::ProcessHandle remote_process_handle);
// IPC::Channel::Listener implementation.
- virtual void OnChannelError();
+ virtual void OnChannelError() OVERRIDE;
};
// The dispatcher for the broker side of the broker channel.
@@ -56,7 +58,7 @@ class PPAPI_PROXY_EXPORT BrokerSideDispatcher : public BrokerDispatcher {
PP_ConnectInstance_Func connect_instance);
// IPC::Channel::Listener implementation.
- virtual void OnChannelError();
+ virtual void OnChannelError() OVERRIDE;
};
} // namespace proxy