| 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_CONTEXT_H_ | 5 #ifndef NET_REPORTING_REPORTING_CONTEXT_H_ |
| 6 #define NET_REPORTING_REPORTING_CONTEXT_H_ | 6 #define NET_REPORTING_REPORTING_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "net/base/backoff_entry.h" | 12 #include "net/base/backoff_entry.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 #include "net/reporting/reporting_policy.h" | 14 #include "net/reporting/reporting_policy.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class Clock; | 17 class Clock; |
| 18 class TickClock; | 18 class TickClock; |
| 19 } // namespace base | 19 } // namespace base |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class ReportingBrowsingDataRemover; | 23 class ReportingBrowsingDataRemover; |
| 24 class ReportingCache; | 24 class ReportingCache; |
| 25 class ReportingDelegate; |
| 25 class ReportingDeliveryAgent; | 26 class ReportingDeliveryAgent; |
| 26 class ReportingEndpointManager; | 27 class ReportingEndpointManager; |
| 27 class ReportingGarbageCollector; | 28 class ReportingGarbageCollector; |
| 28 class ReportingNetworkChangeObserver; | 29 class ReportingNetworkChangeObserver; |
| 29 class ReportingObserver; | 30 class ReportingObserver; |
| 30 class ReportingPersister; | 31 class ReportingPersister; |
| 31 class ReportingUploader; | 32 class ReportingUploader; |
| 32 class URLRequestContext; | 33 class URLRequestContext; |
| 33 | 34 |
| 34 // Contains the various internal classes that make up the Reporting system. | 35 // Contains the various internal classes that make up the Reporting system. |
| 35 // Wrapped by ReportingService, which provides the external interface. | 36 // Wrapped by ReportingService, which provides the external interface. |
| 36 class NET_EXPORT ReportingContext { | 37 class NET_EXPORT ReportingContext { |
| 37 public: | 38 public: |
| 38 static std::unique_ptr<ReportingContext> Create( | 39 static std::unique_ptr<ReportingContext> Create( |
| 39 const ReportingPolicy& policy, | 40 const ReportingPolicy& policy, |
| 40 URLRequestContext* request_context); | 41 URLRequestContext* request_context); |
| 41 | 42 |
| 42 ~ReportingContext(); | 43 ~ReportingContext(); |
| 43 | 44 |
| 44 const ReportingPolicy& policy() { return policy_; } | 45 const ReportingPolicy& policy() { return policy_; } |
| 45 | 46 |
| 46 base::Clock* clock() { return clock_.get(); } | 47 base::Clock* clock() { return clock_.get(); } |
| 47 base::TickClock* tick_clock() { return tick_clock_.get(); } | 48 base::TickClock* tick_clock() { return tick_clock_.get(); } |
| 48 ReportingUploader* uploader() { return uploader_.get(); } | 49 ReportingUploader* uploader() { return uploader_.get(); } |
| 49 | 50 |
| 51 ReportingDelegate* delegate() { return delegate_.get(); } |
| 50 ReportingCache* cache() { return cache_.get(); } | 52 ReportingCache* cache() { return cache_.get(); } |
| 51 ReportingEndpointManager* endpoint_manager() { | 53 ReportingEndpointManager* endpoint_manager() { |
| 52 return endpoint_manager_.get(); | 54 return endpoint_manager_.get(); |
| 53 } | 55 } |
| 54 ReportingDeliveryAgent* delivery_agent() { return delivery_agent_.get(); } | 56 ReportingDeliveryAgent* delivery_agent() { return delivery_agent_.get(); } |
| 55 ReportingGarbageCollector* garbage_collector() { | 57 ReportingGarbageCollector* garbage_collector() { |
| 56 return garbage_collector_.get(); | 58 return garbage_collector_.get(); |
| 57 } | 59 } |
| 58 ReportingBrowsingDataRemover* browsing_data_remover() { | 60 ReportingBrowsingDataRemover* browsing_data_remover() { |
| 59 return browsing_data_remover_.get(); | 61 return browsing_data_remover_.get(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 | 76 |
| 75 private: | 77 private: |
| 76 ReportingPolicy policy_; | 78 ReportingPolicy policy_; |
| 77 | 79 |
| 78 std::unique_ptr<base::Clock> clock_; | 80 std::unique_ptr<base::Clock> clock_; |
| 79 std::unique_ptr<base::TickClock> tick_clock_; | 81 std::unique_ptr<base::TickClock> tick_clock_; |
| 80 std::unique_ptr<ReportingUploader> uploader_; | 82 std::unique_ptr<ReportingUploader> uploader_; |
| 81 | 83 |
| 82 base::ObserverList<ReportingObserver, /* check_empty= */ true> observers_; | 84 base::ObserverList<ReportingObserver, /* check_empty= */ true> observers_; |
| 83 | 85 |
| 86 std::unique_ptr<ReportingDelegate> delegate_; |
| 87 |
| 84 std::unique_ptr<ReportingCache> cache_; | 88 std::unique_ptr<ReportingCache> cache_; |
| 85 | 89 |
| 86 // |endpoint_manager_| must come after |tick_clock_| and |cache_|. | 90 // |endpoint_manager_| must come after |tick_clock_| and |cache_|. |
| 87 std::unique_ptr<ReportingEndpointManager> endpoint_manager_; | 91 std::unique_ptr<ReportingEndpointManager> endpoint_manager_; |
| 88 | 92 |
| 89 // |delivery_agent_| must come after |tick_clock_|, |uploader_|, |cache_|, | 93 // |delivery_agent_| must come after |tick_clock_|, |delegate_|, |uploader_|, |
| 90 // and |endpoint_manager_|. | 94 // |cache_|, and |endpoint_manager_|. |
| 91 std::unique_ptr<ReportingDeliveryAgent> delivery_agent_; | 95 std::unique_ptr<ReportingDeliveryAgent> delivery_agent_; |
| 92 | 96 |
| 93 // |persister_| must come after |clock_|, |tick_clock_|, and |cache_|. | 97 // |persister_| must come after |clock_|, |tick_clock_|, and |cache_|. |
| 94 std::unique_ptr<ReportingPersister> persister_; | 98 std::unique_ptr<ReportingPersister> persister_; |
| 95 | 99 |
| 96 // |garbage_collector_| must come after |tick_clock_| and |cache_|. | 100 // |garbage_collector_| must come after |tick_clock_| and |cache_|. |
| 97 std::unique_ptr<ReportingGarbageCollector> garbage_collector_; | 101 std::unique_ptr<ReportingGarbageCollector> garbage_collector_; |
| 98 | 102 |
| 99 // |network_change_observer_| must come after |cache_|. | 103 // |network_change_observer_| must come after |cache_|. |
| 100 std::unique_ptr<ReportingNetworkChangeObserver> network_change_observer_; | 104 std::unique_ptr<ReportingNetworkChangeObserver> network_change_observer_; |
| 101 | 105 |
| 102 // |browsing_data_remover_| must come after |cache_|. | 106 // |browsing_data_remover_| must come after |cache_|. |
| 103 std::unique_ptr<ReportingBrowsingDataRemover> browsing_data_remover_; | 107 std::unique_ptr<ReportingBrowsingDataRemover> browsing_data_remover_; |
| 104 | 108 |
| 105 DISALLOW_COPY_AND_ASSIGN(ReportingContext); | 109 DISALLOW_COPY_AND_ASSIGN(ReportingContext); |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 } // namespace net | 112 } // namespace net |
| 109 | 113 |
| 110 #endif // NET_REPORTING_REPORTING_CONTEXT_H_ | 114 #endif // NET_REPORTING_REPORTING_CONTEXT_H_ |
| OLD | NEW |