OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_REPORTING_REPORTING_OBSERVER_H_ | 5 #ifndef NET_REPORTING_REPORTING_OBSERVER_H_ |
6 #define NET_REPORTING_REPORTING_OBSERVER_H_ | 6 #define NET_REPORTING_REPORTING_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 class NET_EXPORT ReportingObserver { | 13 class NET_EXPORT ReportingObserver { |
14 public: | 14 public: |
| 15 // Called during ReportingContext::Initialize, before any calls to |
| 16 // OnContextInitialized. |
| 17 // |
| 18 // This is the correct time to preload or restore data in the |
| 19 // ReportingCache, since other observers won't act on it until all observers |
| 20 // have had a chance to initialize. |
| 21 virtual void OnContextInitializing(); |
| 22 |
| 23 // Called during ReportingContext::Initialize, after all calls to |
| 24 // OnContextInitializing. |
| 25 // |
| 26 // This is the correct time to start timers or network requests based on data |
| 27 // restored by other observers. |
| 28 virtual void OnContextInitialized(); |
| 29 |
| 30 // Once ReportingContext::Initialize has called OnContextInitializing on all |
| 31 // Observers, OnCacheUpdated will be called on any update to the |
| 32 // ReportingCache. |
15 virtual void OnCacheUpdated(); | 33 virtual void OnCacheUpdated(); |
16 | 34 |
17 protected: | 35 protected: |
18 ReportingObserver(); | 36 ReportingObserver(); |
19 | 37 |
20 ~ReportingObserver(); | 38 ~ReportingObserver(); |
21 | 39 |
22 DISALLOW_COPY_AND_ASSIGN(ReportingObserver); | 40 DISALLOW_COPY_AND_ASSIGN(ReportingObserver); |
23 }; | 41 }; |
24 | 42 |
25 } // namespace net | 43 } // namespace net |
26 | 44 |
27 #endif // NET_REPORTING_REPORTING_OBSERVER_H_ | 45 #endif // NET_REPORTING_REPORTING_OBSERVER_H_ |
OLD | NEW |