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

Side by Side Diff: net/reporting/reporting_context.cc

Issue 2891133003: Reporting: Wire ReportingDelegate into ChromeNetworkDelegate (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « net/reporting/reporting_context.h ('k') | net/reporting/reporting_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/reporting/reporting_context.h" 5 #include "net/reporting/reporting_context.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 21 matching lines...) Expand all
32 32
33 namespace { 33 namespace {
34 34
35 class ReportingContextImpl : public ReportingContext { 35 class ReportingContextImpl : public ReportingContext {
36 public: 36 public:
37 ReportingContextImpl(const ReportingPolicy& policy, 37 ReportingContextImpl(const ReportingPolicy& policy,
38 URLRequestContext* request_context) 38 URLRequestContext* request_context)
39 : ReportingContext(policy, 39 : ReportingContext(policy,
40 base::MakeUnique<base::DefaultClock>(), 40 base::MakeUnique<base::DefaultClock>(),
41 base::MakeUnique<base::DefaultTickClock>(), 41 base::MakeUnique<base::DefaultTickClock>(),
42 ReportingUploader::Create(request_context)) {} 42 ReportingUploader::Create(request_context),
43 ReportingDelegate::Create(request_context)) {}
43 }; 44 };
44 45
45 } // namespace 46 } // namespace
46 47
47 // static 48 // static
48 std::unique_ptr<ReportingContext> ReportingContext::Create( 49 std::unique_ptr<ReportingContext> ReportingContext::Create(
49 const ReportingPolicy& policy, 50 const ReportingPolicy& policy,
50 URLRequestContext* request_context) { 51 URLRequestContext* request_context) {
51 return base::MakeUnique<ReportingContextImpl>(policy, request_context); 52 return base::MakeUnique<ReportingContextImpl>(policy, request_context);
52 } 53 }
(...skipping 11 matching lines...) Expand all
64 } 65 }
65 66
66 void ReportingContext::NotifyCacheUpdated() { 67 void ReportingContext::NotifyCacheUpdated() {
67 for (auto& observer : observers_) 68 for (auto& observer : observers_)
68 observer.OnCacheUpdated(); 69 observer.OnCacheUpdated();
69 } 70 }
70 71
71 ReportingContext::ReportingContext(const ReportingPolicy& policy, 72 ReportingContext::ReportingContext(const ReportingPolicy& policy,
72 std::unique_ptr<base::Clock> clock, 73 std::unique_ptr<base::Clock> clock,
73 std::unique_ptr<base::TickClock> tick_clock, 74 std::unique_ptr<base::TickClock> tick_clock,
74 std::unique_ptr<ReportingUploader> uploader) 75 std::unique_ptr<ReportingUploader> uploader,
76 std::unique_ptr<ReportingDelegate> delegate)
75 : policy_(policy), 77 : policy_(policy),
76 clock_(std::move(clock)), 78 clock_(std::move(clock)),
77 tick_clock_(std::move(tick_clock)), 79 tick_clock_(std::move(tick_clock)),
78 uploader_(std::move(uploader)), 80 uploader_(std::move(uploader)),
79 delegate_(ReportingDelegate::Create()), 81 delegate_(std::move(delegate)),
80 cache_(base::MakeUnique<ReportingCache>(this)), 82 cache_(base::MakeUnique<ReportingCache>(this)),
81 endpoint_manager_(base::MakeUnique<ReportingEndpointManager>(this)), 83 endpoint_manager_(base::MakeUnique<ReportingEndpointManager>(this)),
82 delivery_agent_(ReportingDeliveryAgent::Create(this)), 84 delivery_agent_(ReportingDeliveryAgent::Create(this)),
83 persister_(ReportingPersister::Create(this)), 85 persister_(ReportingPersister::Create(this)),
84 garbage_collector_(ReportingGarbageCollector::Create(this)), 86 garbage_collector_(ReportingGarbageCollector::Create(this)),
85 network_change_observer_(ReportingNetworkChangeObserver::Create(this)), 87 network_change_observer_(ReportingNetworkChangeObserver::Create(this)),
86 browsing_data_remover_(ReportingBrowsingDataRemover::Create(this)) {} 88 browsing_data_remover_(ReportingBrowsingDataRemover::Create(this)) {}
87 89
88 } // namespace net 90 } // namespace net
OLDNEW
« no previous file with comments | « net/reporting/reporting_context.h ('k') | net/reporting/reporting_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698