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

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

Issue 2770443002: Reporting: Wrap context in service. (Closed)
Patch Set: rebase 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
« no previous file with comments | « net/BUILD.gn ('k') | net/reporting/reporting_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_REPORTING_REPORTING_SERVICE_H_
6 #define NET_REPORTING_REPORTING_SERVICE_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "net/base/net_export.h"
14
15 class GURL;
16
17 namespace base {
18 class Value;
19 } // namespace
20
21 namespace net {
22
23 class ReportingContext;
24 class ReportingDelegate;
25 struct ReportingPolicy;
26 class URLRequestContext;
27
28 // The external interface to the Reporting system, used by the embedder of //net
29 // and also other parts of //net.
30 class NET_EXPORT ReportingService {
31 public:
32 virtual ~ReportingService();
33
34 // Creates a ReportingService. |policy| will be copied. |request_context| must
35 // outlive the ReportingService. The ReportingService will take ownership of
36 // |delegate| and destroy it when the service is destroyed.
37 static std::unique_ptr<ReportingService> Create(
38 const ReportingPolicy& policy,
39 URLRequestContext* request_context,
40 std::unique_ptr<ReportingDelegate> delegate);
41
42 // Creates a ReportingService for testing purposes using an
43 // already-constructed ReportingContext. The ReportingService will take
44 // ownership of |reporting_context| and destroy it when the service is
45 // destroyed.
46 static std::unique_ptr<ReportingService> CreateForTesting(
47 std::unique_ptr<ReportingContext> reporting_context);
48
49 // Queues a report for delivery. |url| is the URL that originated the report.
50 // |group| is the endpoint group to which the report should be delivered.
51 // |type| is the type of the report. |body| is the body of the report.
52 //
53 // The Reporting system will take ownership of |body|; all other parameters
54 // will be copied.
55 virtual void QueueReport(const GURL& url,
56 const std::string& group,
57 const std::string& type,
58 std::unique_ptr<const base::Value> body) = 0;
59
60 // Processes a Report-To header. |url| is the URL that originated the header;
61 // |header_value| is the normalized value of the Report-To header.
62 virtual void ProcessHeader(const GURL& url,
63 const std::string& header_value) = 0;
64
65 protected:
66 ReportingService() {}
67
68 private:
69 DISALLOW_COPY_AND_ASSIGN(ReportingService);
70 };
71
72 } // namespace net
73
74 #endif // NET_REPORTING_REPORTING_SERVICE_H_
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/reporting/reporting_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698