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

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

Issue 2829683004: Reporting: Plumb from //chrome/browser/browsing_data. (Closed)
Patch Set: 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 unified diff | Download patch
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_service.h" 5 #include "net/reporting/reporting_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/time/tick_clock.h" 12 #include "base/time/tick_clock.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "net/reporting/reporting_browsing_data_remover.h"
15 #include "net/reporting/reporting_cache.h" 16 #include "net/reporting/reporting_cache.h"
16 #include "net/reporting/reporting_context.h" 17 #include "net/reporting/reporting_context.h"
17 #include "net/reporting/reporting_delegate.h" 18 #include "net/reporting/reporting_delegate.h"
18 #include "net/reporting/reporting_header_parser.h" 19 #include "net/reporting/reporting_header_parser.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 namespace net { 22 namespace net {
22 23
23 namespace { 24 namespace {
24 25
(...skipping 16 matching lines...) Expand all
41 context_->cache()->AddReport(url, group, type, std::move(body), 42 context_->cache()->AddReport(url, group, type, std::move(body),
42 context_->tick_clock()->NowTicks(), 0); 43 context_->tick_clock()->NowTicks(), 0);
43 } 44 }
44 45
45 void ProcessHeader(const GURL& url, 46 void ProcessHeader(const GURL& url,
46 const std::string& header_value) override { 47 const std::string& header_value) override {
47 DCHECK(context_->initialized()); 48 DCHECK(context_->initialized());
48 ReportingHeaderParser::ParseHeader(context_.get(), url, header_value); 49 ReportingHeaderParser::ParseHeader(context_.get(), url, header_value);
49 } 50 }
50 51
52 void RemoveBrowsingData(
53 int data_type_mask,
54 base::Callback<bool(const GURL&)> origin_filter) override {
55 context_->browsing_data_remover()->RemoveBrowsingData(data_type_mask,
56 origin_filter);
57 }
58
51 private: 59 private:
52 std::unique_ptr<ReportingContext> context_; 60 std::unique_ptr<ReportingContext> context_;
53 61
54 DISALLOW_COPY_AND_ASSIGN(ReportingServiceImpl); 62 DISALLOW_COPY_AND_ASSIGN(ReportingServiceImpl);
55 }; 63 };
56 64
57 } // namespace 65 } // namespace
58 66
59 ReportingService::~ReportingService() {} 67 ReportingService::~ReportingService() {}
60 68
61 // static 69 // static
62 std::unique_ptr<ReportingService> ReportingService::Create( 70 std::unique_ptr<ReportingService> ReportingService::Create(
63 const ReportingPolicy& policy, 71 const ReportingPolicy& policy,
64 URLRequestContext* request_context, 72 URLRequestContext* request_context,
65 std::unique_ptr<ReportingDelegate> delegate) { 73 std::unique_ptr<ReportingDelegate> delegate) {
66 return base::MakeUnique<ReportingServiceImpl>( 74 return base::MakeUnique<ReportingServiceImpl>(
67 ReportingContext::Create(policy, std::move(delegate), request_context)); 75 ReportingContext::Create(policy, std::move(delegate), request_context));
68 } 76 }
69 77
70 // static 78 // static
71 std::unique_ptr<ReportingService> ReportingService::CreateForTesting( 79 std::unique_ptr<ReportingService> ReportingService::CreateForTesting(
72 std::unique_ptr<ReportingContext> reporting_context) { 80 std::unique_ptr<ReportingContext> reporting_context) {
73 return base::MakeUnique<ReportingServiceImpl>(std::move(reporting_context)); 81 return base::MakeUnique<ReportingServiceImpl>(std::move(reporting_context));
74 } 82 }
75 83
76 } // namespace net 84 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698