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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 874613004: Remove NOTIFICATION_BROWSING_DATA_REMOVED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename global variable Created 5 years, 11 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
Index: chrome/browser/browsing_data/browsing_data_remover.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index 7987a92b972853da4aa464556bc68cac0b1fb197..189586b30c529c0a68357d77fe3cd8a2b151c1b0 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -101,6 +101,24 @@ using content::BrowserContext;
using content::BrowserThread;
using content::DOMStorageContext;
+namespace {
+
+using CallbackList =
+ base::CallbackList<void(const BrowsingDataRemover::NotificationDetails&)>;
+
+// Contains all registered callbacks for browsing data removed notifications.
+CallbackList* g_on_browsing_data_removed_callbacks = nullptr;
+
+// Accessor for |*g_on_browsing_data_removed_callbacks|. Creates a new object
+// the first time so that it always returns a valid object.
+CallbackList* GetOnBrowsingDataRemovedCallbacks() {
+ if (!g_on_browsing_data_removed_callbacks)
+ g_on_browsing_data_removed_callbacks = new CallbackList();
+ return g_on_browsing_data_removed_callbacks;
+}
+
+} // namespace
+
bool BrowsingDataRemover::is_removing_ = false;
BrowsingDataRemover::CompletionInhibitor*
@@ -808,13 +826,11 @@ void BrowsingDataRemover::OnKeywordsLoaded() {
void BrowsingDataRemover::NotifyAndDelete() {
set_removing(false);
- // Send global notification, then notify any explicit observers.
+ // Notify observers.
BrowsingDataRemover::NotificationDetails details(delete_begin_, remove_mask_,
origin_set_mask_);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
- content::Source<Profile>(profile_),
- content::Details<BrowsingDataRemover::NotificationDetails>(&details));
+
+ GetOnBrowsingDataRemovedCallbacks()->Notify(details);
FOR_EACH_OBSERVER(Observer, observer_list_, OnBrowsingDataRemoverDone());
@@ -1199,3 +1215,10 @@ void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
waiting_for_clear_domain_reliability_monitor_ = false;
NotifyAndDeleteIfDone();
}
+
+// static
+BrowsingDataRemover::CallbackSubscription
+ BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
+ const BrowsingDataRemover::Callback& callback) {
+ return GetOnBrowsingDataRemovedCallbacks()->Add(callback);
+}
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698