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_DELEGATE_H_ | 5 #ifndef NET_REPORTING_REPORTING_DELEGATE_H_ |
6 #define NET_REPORTING_REPORTING_DELEGATE_H_ | 6 #define NET_REPORTING_REPORTING_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace url { | 15 namespace url { |
16 class Origin; | 16 class Origin; |
17 } // namespace url | 17 } // namespace url |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
| 21 class URLRequestContext; |
| 22 |
21 class NET_EXPORT ReportingDelegate { | 23 class NET_EXPORT ReportingDelegate { |
22 public: | 24 public: |
23 virtual ~ReportingDelegate(); | 25 virtual ~ReportingDelegate(); |
24 | 26 |
25 // Checks whether |origin| is allowed to queue reports for future delivery. | 27 // Checks whether |origin| is allowed to queue reports for future delivery. |
26 virtual bool CanQueueReport(const url::Origin& origin) const = 0; | 28 virtual bool CanQueueReport(const url::Origin& origin) const = 0; |
27 | 29 |
28 // Checks whether |origin| is allowed to receive reports, either in real time | 30 // Checks whether |origin| is allowed to receive reports, either in real time |
29 // or that were queued earlier. | 31 // or that were queued earlier. |
30 virtual bool CanSendReport(const url::Origin& origin) const = 0; | 32 virtual bool CanSendReport(const url::Origin& origin) const = 0; |
31 | 33 |
32 // Checks whether |origin| can set |endpoint| to be used for future report | 34 // Checks whether |origin| can set |endpoint| to be used for future report |
33 // deliveries. | 35 // deliveries. |
34 virtual bool CanSetClient(const url::Origin& origin, | 36 virtual bool CanSetClient(const url::Origin& origin, |
35 const GURL& endpoint) const = 0; | 37 const GURL& endpoint) const = 0; |
36 | 38 |
37 // Checks whether |origin| can use |endpoint| for a report delivery right now. | 39 // Checks whether |origin| can use |endpoint| for a report delivery right now. |
38 virtual bool CanUseClient(const url::Origin& origin, | 40 virtual bool CanUseClient(const url::Origin& origin, |
39 const GURL& endpoint) const = 0; | 41 const GURL& endpoint) const = 0; |
40 | 42 |
41 static std::unique_ptr<ReportingDelegate> Create(); | 43 static std::unique_ptr<ReportingDelegate> Create( |
| 44 URLRequestContext* request_context); |
42 }; | 45 }; |
43 | 46 |
44 } // namespace net | 47 } // namespace net |
45 | 48 |
46 #endif // NET_REPORTING_REPORTING_DELEGATE_H_ | 49 #endif // NET_REPORTING_REPORTING_DELEGATE_H_ |
OLD | NEW |