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

Unified Diff: net/reporting/reporting_context.h

Issue 2778373003: Reporting: Add Observer interface to observe cache updates. (Closed)
Patch Set: rebase Created 3 years, 8 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 | « net/reporting/reporting_cache_unittest.cc ('k') | net/reporting/reporting_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_context.h
diff --git a/net/reporting/reporting_context.h b/net/reporting/reporting_context.h
index 609813a5ad5d2944b9cc03dacc72d5856296848b..02425615039dd282419b9ebebc718df6c4592111 100644
--- a/net/reporting/reporting_context.h
+++ b/net/reporting/reporting_context.h
@@ -7,6 +7,7 @@
#include <memory>
+#include "base/observer_list.h"
#include "base/time/time.h"
#include "net/base/backoff_entry.h"
#include "net/base/net_export.h"
@@ -23,6 +24,7 @@ class ReportingCache;
class ReportingDelegate;
class ReportingDeliveryAgent;
class ReportingEndpointManager;
+class ReportingObserver;
class ReportingUploader;
class URLRequestContext;
@@ -50,6 +52,11 @@ class NET_EXPORT ReportingContext {
}
ReportingDeliveryAgent* delivery_agent() { return delivery_agent_.get(); }
+ void AddObserver(ReportingObserver* observer);
+ void RemoveObserver(ReportingObserver* observer);
+
+ void NotifyCacheUpdated();
+
protected:
ReportingContext(const ReportingPolicy& policy,
std::unique_ptr<ReportingDelegate> delegate,
@@ -65,6 +72,8 @@ class NET_EXPORT ReportingContext {
std::unique_ptr<base::TickClock> tick_clock_;
std::unique_ptr<ReportingUploader> uploader_;
+ base::ObserverList<ReportingObserver, /* check_empty= */ true> observers_;
+
std::unique_ptr<ReportingCache> cache_;
// |endpoint_manager_| must come after |tick_clock_| and |cache_|.
« no previous file with comments | « net/reporting/reporting_cache_unittest.cc ('k') | net/reporting/reporting_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698