Chromium Code Reviews| 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_ |