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_HEADER_PARSER_H_ | 5 #ifndef NET_REPORTING_REPORTING_HEADER_PARSER_H_ |
6 #define NET_REPORTING_REPORTING_HEADER_PARSER_H_ | 6 #define NET_REPORTING_REPORTING_HEADER_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | |
12 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
13 | 12 |
14 class GURL; | 13 class GURL; |
15 | 14 |
16 namespace base { | |
17 class Value; | |
18 } // namespace base | |
19 | |
20 namespace net { | 15 namespace net { |
21 | 16 |
22 class ReportingCache; | |
23 class ReportingContext; | 17 class ReportingContext; |
24 | 18 |
25 class NET_EXPORT ReportingHeaderParser { | 19 class NET_EXPORT ReportingHeaderParser { |
26 public: | 20 public: |
27 static void ParseHeader(ReportingContext* context, | 21 static void ParseHeader(ReportingContext* context, |
28 const GURL& url, | 22 const GURL& url, |
29 const std::string& json_value); | 23 const std::string& json_value); |
30 | 24 |
31 private: | 25 private: |
32 // Processes a single endpoint's parsed value from the Report-To header(s). | |
33 // Creates, updates, or removes a client in the cache as needed. | |
34 // | |
35 // |url| is the URL that the header came from. | |
36 // | |
37 // |value| is the parsed value. | |
38 static void ProcessEndpoint(ReportingCache* cache, | |
39 base::TimeTicks now, | |
40 const GURL& url, | |
41 const base::Value& value); | |
42 | |
43 DISALLOW_IMPLICIT_CONSTRUCTORS(ReportingHeaderParser); | 26 DISALLOW_IMPLICIT_CONSTRUCTORS(ReportingHeaderParser); |
44 }; | 27 }; |
45 | 28 |
46 } // namespace net | 29 } // namespace net |
47 | 30 |
48 #endif // NET_REPORTING_REPORTING_HEADER_PARSER_H_ | 31 #endif // NET_REPORTING_REPORTING_HEADER_PARSER_H_ |
OLD | NEW |