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

Unified Diff: chrome/plugin/plugin_channel.cc

Issue 4832002: Add PluginDataRemover. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: foo Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/plugin/plugin_channel.h ('k') | webkit/glue/plugins/plugin_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/plugin_channel.cc
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc
index aa3b7130379c53e5b6325f91cc9ac00165f95d2d..0b6d5da1379999ea59933e38183f34b897b8a8f8 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);
« no previous file with comments | « chrome/plugin/plugin_channel.h ('k') | webkit/glue/plugins/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698