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

Unified Diff: net/reporting/reporting_delegate_impl.h

Issue 2689953004: Reporting: Implement header parser. (Closed)
Patch Set: DISALLOW_COPY_AND_ASSIGN Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/reporting/reporting_delegate_impl.h
diff --git a/net/reporting/reporting_delegate_impl.h b/net/reporting/reporting_delegate_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..d900f5cbe86fb2b6ebddb8e316b1e3b81c46ca34
--- /dev/null
+++ b/net/reporting/reporting_delegate_impl.h
@@ -0,0 +1,52 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_REPORTING_REPORTING_DELEGATE_IMPL_H_
+#define NET_REPORTING_REPORTING_DELEGATE_IMPL_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/time/tick_clock.h"
+#include "base/values.h"
+#include "net/base/net_export.h"
+#include "net/reporting/reporting_delegate.h"
+#include "url/gurl.h"
+
+namespace net {
+
+class ReportingCache;
+
+class NET_EXPORT ReportingDelegateImpl : public ReportingDelegate {
+ public:
+ ReportingDelegateImpl(base::TickClock* clock, ReportingCache* cache);
shivanisha 2017/03/15 23:38:01 Since the constructor takes raw pointers, it needs
+
+ ~ReportingDelegateImpl() override;
+
+ void OnReportGenerated(const GURL& url,
+ const std::string& group,
+ const std::string& type,
+ std::unique_ptr<const base::Value> body) override;
+
+ void OnHeaderReceived(const GURL& url,
+ const std::string& json_value) override;
+
+ private:
+ // Processes a single endpoint's parsed value from the Report-To header(s).
+ // Creates, updates, or removes a client in the cache as needed.
+ //
shivanisha 2017/03/15 23:38:01 We can probably remove the empty lines between par
+ // |url| is the URL that the header came from.
+ //
+ // |value| is the parsed value.
+ void ProcessEndpoint(const GURL& url, const base::Value& value);
+
+ base::TickClock* clock_;
+ ReportingCache* cache_;
+
+ DISALLOW_COPY_AND_ASSIGN(ReportingDelegateImpl);
+};
+
+} // namespace net
+
+#endif // NET_REPORTING_REPORTING_DELEGATE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698