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