Index: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc |
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc |
index afdb914649f31b6c8f227068efbc38e676a244da..9dc637662506e069a8849b5ba49872a8263acde1 100644 |
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc |
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc |
@@ -144,16 +144,15 @@ bool BrowsingDataExtensionFunction::RunImpl() { |
removal_mask_ = GetRemovalMask(); |
- if (removal_mask_ & BrowsingDataRemover::REMOVE_PLUGIN_DATA) { |
+ if (removal_mask_ & BrowsingDataRemover::REMOVE_PLUGIN_DATA && profile()) { |
Bernhard Bauer
2012/08/08 11:46:51
I think we do have a profile at this point. I woul
|
// If we're being asked to remove plugin data, check whether it's actually |
// supported. |
- Profile* profile = GetCurrentBrowser()->profile(); |
BrowserThread::PostTask( |
BrowserThread::FILE, FROM_HERE, |
base::Bind( |
&BrowsingDataExtensionFunction::CheckRemovingPluginDataSupported, |
this, |
- PluginPrefs::GetForProfile(profile))); |
+ PluginPrefs::GetForProfile(profile()))); |
} else { |
StartRemoving(); |
} |
@@ -176,12 +175,18 @@ void BrowsingDataExtensionFunction::StartRemoving() { |
// If we're good to go, add a ref (Balanced in OnBrowsingDataRemoverDone) |
AddRef(); |
+ // If we've got no profile, exit early. |
+ if (!profile()) { |
+ OnBrowsingDataRemoverDone(); |
+ return; |
+ } |
+ |
// Create a BrowsingDataRemover, set the current object as an observer (so |
// that we're notified after removal) and call remove() with the arguments |
// we've generated above. We can use a raw pointer here, as the browsing data |
// remover is responsible for deleting itself once data removal is complete. |
- BrowsingDataRemover* remover = new BrowsingDataRemover( |
- GetCurrentBrowser()->profile(), remove_since_, base::Time::Now()); |
+ BrowsingDataRemover* remover = new BrowsingDataRemover(profile(), |
+ remove_since_, base::Time::Now()); |
remover->AddObserver(this); |
remover->Remove(removal_mask_, origin_set_mask_); |
} |