xref: /aosp_15_r20/external/cronet/net/reporting/reporting_cache_observer.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_REPORTING_REPORTING_CACHE_OBSERVER_H_
6 #define NET_REPORTING_REPORTING_CACHE_OBSERVER_H_
7 
8 #include <vector>
9 
10 #include "net/base/net_export.h"
11 #include "net/reporting/reporting_endpoint.h"
12 #include "net/reporting/reporting_report.h"
13 
14 namespace net {
15 
16 class NET_EXPORT ReportingCacheObserver {
17  public:
18   ReportingCacheObserver(const ReportingCacheObserver&) = delete;
19   ReportingCacheObserver& operator=(const ReportingCacheObserver&) = delete;
20 
21   // Called whenever any change is made to the reports in the ReportingCache.
22   virtual void OnReportsUpdated();
23 
24   // Called whenever a new report is added to the ReportingCache.
25   virtual void OnReportAdded(const ReportingReport* report);
26 
27   // Called whenever a report in the ReportingCache is updated.
28   virtual void OnReportUpdated(const ReportingReport* report);
29 
30   // Called whenever any change is made to the client entries in the
31   // ReportingCache.
32   virtual void OnClientsUpdated();
33 
34   // Called when V1 reporting endpoints for an origin are updated in the
35   // ReportingCache.
36   virtual void OnEndpointsUpdatedForOrigin(
37       const std::vector<ReportingEndpoint>& endpoints);
38 
39  protected:
40   ReportingCacheObserver();
41 
42   ~ReportingCacheObserver();
43 };
44 
45 }  // namespace net
46 
47 #endif  // NET_REPORTING_REPORTING_CACHE_OBSERVER_H_
48