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

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

Issue 2751103002: Reporting: Wrap existing classes in context. (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
OLDNEW
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" 11 #include "base/time/time.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 13
14 class GURL; 14 class GURL;
15 15
16 namespace base { 16 namespace base {
17 class Value; 17 class Value;
18 } // namespace base 18 } // namespace base
19 19
20 namespace net { 20 namespace net {
21 21
22 class ReportingCache; 22 class ReportingCache;
23 class ReportingContext;
23 24
24 // Parses Report-To headers and writes the endpoint configurations to the
25 // ReportingCache.
26 class NET_EXPORT ReportingHeaderParser { 25 class NET_EXPORT ReportingHeaderParser {
27 public: 26 public:
28 // Parses the normalized Report-To header value |json_value| sent in response 27 static void ParseHeader(ReportingContext* context,
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, 28 const GURL& url,
34 const std::string& json_value); 29 const std::string& json_value);
35 30
36 private: 31 private:
37 // Processes a single endpoint's parsed value from the Report-To header(s). 32 // 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. 33 // Creates, updates, or removes a client in the cache as needed.
39 // 34 //
40 // |url| is the URL that the header came from. 35 // |url| is the URL that the header came from.
41 // 36 //
42 // |value| is the parsed value. 37 // |value| is the parsed value.
43 static void ProcessEndpoint(ReportingCache* cache, 38 static void ProcessEndpoint(ReportingCache* cache,
44 base::TimeTicks now, 39 base::TimeTicks now,
45 const GURL& url, 40 const GURL& url,
46 const base::Value& value); 41 const base::Value& value);
47 42
48 DISALLOW_IMPLICIT_CONSTRUCTORS(ReportingHeaderParser); 43 DISALLOW_IMPLICIT_CONSTRUCTORS(ReportingHeaderParser);
49 }; 44 };
50 45
51 } // namespace net 46 } // namespace net
52 47
53 #endif // NET_REPORTING_REPORTING_HEADER_PARSER_H_ 48 #endif // NET_REPORTING_REPORTING_HEADER_PARSER_H_
OLDNEW
« no previous file with comments | « net/reporting/reporting_endpoint_manager_unittest.cc ('k') | net/reporting/reporting_header_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698