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_SERVICE_H_ | 5 #ifndef NET_REPORTING_REPORTING_SERVICE_H_ |
6 #define NET_REPORTING_REPORTING_SERVICE_H_ | 6 #define NET_REPORTING_REPORTING_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class Value; | 18 class Value; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class ReportingContext; | 23 class ReportingContext; |
24 class ReportingDelegate; | |
25 struct ReportingPolicy; | 24 struct ReportingPolicy; |
26 class URLRequestContext; | 25 class URLRequestContext; |
27 | 26 |
28 // The external interface to the Reporting system, used by the embedder of //net | 27 // The external interface to the Reporting system, used by the embedder of //net |
29 // and also other parts of //net. | 28 // and also other parts of //net. |
30 class NET_EXPORT ReportingService { | 29 class NET_EXPORT ReportingService { |
31 public: | 30 public: |
32 virtual ~ReportingService(); | 31 virtual ~ReportingService(); |
33 | 32 |
34 // Creates a ReportingService. |policy| will be copied. |request_context| must | 33 // Creates a ReportingService. |policy| will be copied. |request_context| must |
35 // outlive the ReportingService. The ReportingService will take ownership of | 34 // outlive the ReportingService. |
36 // |delegate| and destroy it when the service is destroyed. | |
37 static std::unique_ptr<ReportingService> Create( | 35 static std::unique_ptr<ReportingService> Create( |
38 const ReportingPolicy& policy, | 36 const ReportingPolicy& policy, |
39 URLRequestContext* request_context, | 37 URLRequestContext* request_context); |
40 std::unique_ptr<ReportingDelegate> delegate); | |
41 | 38 |
42 // Creates a ReportingService for testing purposes using an | 39 // Creates a ReportingService for testing purposes using an |
43 // already-constructed ReportingContext. The ReportingService will take | 40 // already-constructed ReportingContext. The ReportingService will take |
44 // ownership of |reporting_context| and destroy it when the service is | 41 // ownership of |reporting_context| and destroy it when the service is |
45 // destroyed. | 42 // destroyed. |
46 static std::unique_ptr<ReportingService> CreateForTesting( | 43 static std::unique_ptr<ReportingService> CreateForTesting( |
47 std::unique_ptr<ReportingContext> reporting_context); | 44 std::unique_ptr<ReportingContext> reporting_context); |
48 | 45 |
49 // Queues a report for delivery. |url| is the URL that originated the report. | 46 // 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. | 47 // |group| is the endpoint group to which the report should be delivered. |
(...skipping 14 matching lines...) Expand all Loading... |
65 protected: | 62 protected: |
66 ReportingService() {} | 63 ReportingService() {} |
67 | 64 |
68 private: | 65 private: |
69 DISALLOW_COPY_AND_ASSIGN(ReportingService); | 66 DISALLOW_COPY_AND_ASSIGN(ReportingService); |
70 }; | 67 }; |
71 | 68 |
72 } // namespace net | 69 } // namespace net |
73 | 70 |
74 #endif // NET_REPORTING_REPORTING_SERVICE_H_ | 71 #endif // NET_REPORTING_REPORTING_SERVICE_H_ |
OLD | NEW |