summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 13:26:40 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 13:26:40 +0000
commit8b8a554df8a76731fc1b7aa74826ac729ba6980d (patch)
treea082c4de6beece2944c10d40a94bef317fb3f3cc /chrome/plugin
parent9f43551bf8c197bf716530a4d26a368a3cc5e0b3 (diff)
downloadchromium_src-8b8a554df8a76731fc1b7aa74826ac729ba6980d.zip
chromium_src-8b8a554df8a76731fc1b7aa74826ac729ba6980d.tar.gz
chromium_src-8b8a554df8a76731fc1b7aa74826ac729ba6980d.tar.bz2
Add PluginDataRemover.
BUG=58235 TEST=none Review URL: http://codereview.chromium.org/4832002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/plugin_channel.cc31
-rw-r--r--chrome/plugin/plugin_channel.h3
2 files changed, 34 insertions, 0 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc
index aa3b713..0b6d5da 100644
--- a/chrome/plugin/plugin_channel.cc
+++ b/chrome/plugin/plugin_channel.cc
@@ -16,6 +16,7 @@
#include "chrome/plugin/plugin_thread.h"
#include "chrome/plugin/webplugin_delegate_stub.h"
#include "chrome/plugin/webplugin_proxy.h"
+#include "webkit/glue/plugins/plugin_instance.h"
#if defined(OS_POSIX)
#include "base/eintr_wrapper.h"
@@ -211,6 +212,7 @@ void PluginChannel::OnControlMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance,
OnDestroyInstance)
IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID)
+ IPC_MESSAGE_HANDLER(PluginMsg_ClearSiteData, OnClearSiteData)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
@@ -256,6 +258,35 @@ int PluginChannel::GenerateRouteID() {
return ++last_id;
}
+void PluginChannel::OnClearSiteData(uint64 flags,
+ const std::string& domain,
+ base::Time begin_time) {
+ bool success = false;
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath);
+ scoped_refptr<NPAPI::PluginLib> plugin_lib(
+ NPAPI::PluginLib::CreatePluginLib(path));
+ if (plugin_lib.get()) {
+ NPError err = plugin_lib->NP_Initialize();
+ if (err == NPERR_NO_ERROR) {
+ scoped_refptr<NPAPI::PluginInstance> instance(
+ plugin_lib->CreateInstance(std::string()));
+
+ const char* domain_str = domain.empty() ? NULL : domain.c_str();
+ uint64 max_age;
+ if (begin_time > base::Time()) {
+ base::TimeDelta delta = base::Time::Now() - begin_time;
+ max_age = delta.InSeconds();
+ } else {
+ max_age = kuint64max;
+ }
+ err = instance->NPP_ClearSiteData(flags, domain_str, max_age);
+ success = (err == NPERR_NO_ERROR);
+ }
+ }
+ Send(new PluginHostMsg_ClearSiteDataResult(success));
+}
+
base::WaitableEvent* PluginChannel::GetModalDialogEvent(
gfx::NativeViewId containing_window) {
return filter_->GetModalDialogEvent(containing_window);
diff --git a/chrome/plugin/plugin_channel.h b/chrome/plugin/plugin_channel.h
index 3fb940e..cc444c0 100644
--- a/chrome/plugin/plugin_channel.h
+++ b/chrome/plugin/plugin_channel.h
@@ -76,6 +76,9 @@ class PluginChannel : public PluginChannelBase {
void OnCreateInstance(const std::string& mime_type, int* instance_id);
void OnDestroyInstance(int instance_id, IPC::Message* reply_msg);
void OnGenerateRouteID(int* route_id);
+ void OnClearSiteData(uint64 flags,
+ const std::string& domain,
+ base::Time begin_time);
#if defined(OS_POSIX)
// Close the plugin process' copy of the renderer's side of the plugin