Index: chrome/browser/plugin_data_remover.cc |
diff --git a/chrome/browser/plugin_data_remover.cc b/chrome/browser/plugin_data_remover.cc |
index e17254e763163a43daa933325a8c547bc103ac5f..0136f8e9c4bdf3984469669ee333fa4905df71de 100644 |
--- a/chrome/browser/plugin_data_remover.cc |
+++ b/chrome/browser/plugin_data_remover.cc |
@@ -9,6 +9,7 @@ |
#include "base/metrics/histogram.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/version.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/chrome_switches.h" |
#include "content/browser/browser_thread.h" |
#include "content/browser/plugin_service.h" |
@@ -30,9 +31,10 @@ const uint64 kClearAllData = 0; |
} // namespace |
-PluginDataRemover::PluginDataRemover() |
+PluginDataRemover::PluginDataRemover(Profile* profile) |
: mime_type_(kFlashMimeType), |
is_removing_(false), |
+ context_(profile->GetResourceContext()), |
event_(new base::WaitableEvent(true, false)), |
channel_(NULL) { |
} |
@@ -50,11 +52,10 @@ base::WaitableEvent* PluginDataRemover::StartRemoving(base::Time begin_time) { |
is_removing_ = true; |
- // Balanced in OnChannelOpened or OnError. Exactly one them will eventually be |
- // called, so we need to keep this object around until then. |
- AddRef(); |
- PluginService::GetInstance()->OpenChannelToNpapiPlugin( |
- 0, 0, GURL(), mime_type_, this); |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, |
+ FROM_HERE, |
+ NewRunnableMethod(this, &PluginDataRemover::OpenChannel)); |
BrowserThread::PostDelayedTask( |
BrowserThread::IO, |
@@ -65,6 +66,14 @@ base::WaitableEvent* PluginDataRemover::StartRemoving(base::Time begin_time) { |
return event_.get(); |
} |
+void PluginDataRemover::OpenChannel() { |
+ // Balanced in OnChannelOpened or OnError. Exactly one them will eventually be |
+ // called, so we need to keep this object around until then. |
+ AddRef(); |
+ PluginService::GetInstance()->OpenChannelToNpapiPlugin( |
+ 0, 0, GURL(), GURL(), mime_type_, this); |
+} |
+ |
void PluginDataRemover::Wait() { |
base::Time start_time(base::Time::Now()); |
bool result = true; |
@@ -86,6 +95,10 @@ bool PluginDataRemover::OffTheRecord() { |
return false; |
} |
+const content::ResourceContext* PluginDataRemover::GetResourceContext() { |
+ return &context_; |
+} |
+ |
void PluginDataRemover::SetPluginInfo( |
const webkit::npapi::WebPluginInfo& info) { |
} |