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

Unified Diff: net/reporting/reporting_delegate.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.h
diff --git a/net/reporting/reporting_delegate.h b/net/reporting/reporting_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..4851f40087ab34793b785052a6a1015aa8b36320
--- /dev/null
+++ b/net/reporting/reporting_delegate.h
@@ -0,0 +1,59 @@
+// 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_H_
+#define NET_REPORTING_REPORTING_DELEGATE_H_
+
+#include <string>
+
+#include "base/values.h"
+#include "url/gurl.h"
+
+namespace net {
+
+// Interface by which other parts of the network stack (and perhaps the embedder
+// thereof) can queue reports, and by which the network stack can notify the
+// Reporting implementation of received "Report-To" headers.
+class NET_EXPORT ReportingDelegate {
+ public:
+ virtual ~ReportingDelegate() = default;
+
+ // Notifies the Reporting implementation that a report has been generated
+ // elsewhere in the network stack or embedder (and should, ideally, be queued
+ // for delivery).
+ //
+ // |url| is the URL of the document that caused the report.
+ //
+ // |group| is the group of endpoints to which the report should be delivered.
+ //
+ // |type| is the type of report; the Reporting API itself does not specify any
+ // pre-defined types.
+ //
+ // |body| is any additional data to include in the report, as a Value that the
+ // Reporting implementation will take ownership of, and that will be
shivanisha 2017/03/15 23:38:01 reporting does not need to start with capital lett
+ // serialized to JSON when the report is delivered.
+ virtual void OnReportGenerated(const GURL& url,
+ const std::string& group,
+ const std::string& type,
+ std::unique_ptr<const base::Value> body) = 0;
+
+ // Notifies the Reporting implementation that at least one Report-To header
+ // has been observed in the response headers of an HTTP request.
+ //
+ // |url| is the URL of the request whose response contained the header(s).
+ //
+ // |value| is the normalized (multiple instances joined with commas) value of
+ // the header (e.g. as returned by HttpResponseHeaders::GetNormalizedHeader).
+ virtual void OnHeaderReceived(const GURL& url, const std::string& value) = 0;
+
+ protected:
+ ReportingDelegate() = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ReportingDelegate);
+};
+
+} // namespace net
+
+#endif // NET_REPORTING_REPORTING_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698