Index: components/reporting/core/browser/reporting_service.h |
diff --git a/components/reporting/core/browser/reporting_service.h b/components/reporting/core/browser/reporting_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d1a17d78e663170c68d868aee0d5933bba7bad8c |
--- /dev/null |
+++ b/components/reporting/core/browser/reporting_service.h |
@@ -0,0 +1,59 @@ |
+// Copyright 2016 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 COMPONENTS_REPORTING_CORE_BROWSER_REPORTING_SERVICE_H_ |
+#define COMPONENTS_REPORTING_CORE_BROWSER_REPORTING_SERVICE_H_ |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+#include "components/reporting/core/common/reporting_export.h" |
+#include "components/reporting/core/public/interfaces/reporting.mojom.h" |
+#include "net/url_request/url_request_context_getter.h" |
+#include "url/gurl.h" |
+ |
+namespace reporting { |
+ |
+class REPORTING_EXPORT ReportingService : public KeyedService, |
+ public mojom::ReportingService { |
+ public: |
+ ~ReportingService() override; |
+ |
+ // mojom::ReportingService: |
+ void QueueReport(std::unique_ptr<base::Value> body, |
+ const GURL& url, |
+ const GURL& origin, |
+ const std::string& group, |
+ const std::string& type) override = 0; |
+ |
+ // Parses and acts on the reporting endpoints specified in a configuration |
+ // header. |
+ // |
+ // |origin| is the origin of the URL of the request whose response contained |
+ // the header. |
+ // |
+ // |header_value| is the normalized (i.e. multiple values joined with commas) |
+ // value of the header. |
+ // |
+ // The caller is responsible for ensuring that "response's HTTPS state is |
+ // 'modern' and the origin of response's url is potentially trustworthy". |
+ virtual void ProcessHeader(const GURL& origin, |
+ const std::string& header_value) = 0; |
+ |
+ virtual void AddBinding(mojom::ReportingServiceRequest request) = 0; |
+ |
+ static std::unique_ptr<ReportingService> Create( |
+ scoped_refptr<net::URLRequestContextGetter> context, |
+ const base::Callback<bool(const GURL&)>& is_origin_secure); |
+ |
+ protected: |
+ ReportingService(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ReportingService); |
+}; |
+ |
+} // namespace reporting |
+ |
+#endif // COMPONENTS_REPORTING_CORE_BROWSER_REPORTING_SERVICE_H_ |