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

Unified Diff: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc

Issue 10855049: Deal correctly with BrowsingData API calls during startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: That's much simpler. Created 8 years, 4 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698