OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_REPORTING_CORE_BROWSER_REPORTING_SERVICE_H_ |
| 6 #define COMPONENTS_REPORTING_CORE_BROWSER_REPORTING_SERVICE_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" |
| 11 #include "components/reporting/core/common/reporting_export.h" |
| 12 #include "components/reporting/core/public/interfaces/reporting.mojom.h" |
| 13 #include "net/url_request/url_request_context_getter.h" |
| 14 #include "url/gurl.h" |
| 15 |
| 16 namespace reporting { |
| 17 |
| 18 class REPORTING_EXPORT ReportingService : public KeyedService, |
| 19 public mojom::ReportingService { |
| 20 public: |
| 21 ~ReportingService() override; |
| 22 |
| 23 // mojom::ReportingService: |
| 24 void QueueReport(std::unique_ptr<base::Value> body, |
| 25 const GURL& url, |
| 26 const GURL& origin, |
| 27 const std::string& group, |
| 28 const std::string& type) override = 0; |
| 29 |
| 30 // Parses and acts on the reporting endpoints specified in a configuration |
| 31 // header. |
| 32 // |
| 33 // |origin| is the origin of the URL of the request whose response contained |
| 34 // the header. |
| 35 // |
| 36 // |header_value| is the normalized (i.e. multiple values joined with commas) |
| 37 // value of the header. |
| 38 // |
| 39 // The caller is responsible for ensuring that "response's HTTPS state is |
| 40 // 'modern' and the origin of response's url is potentially trustworthy". |
| 41 virtual void ProcessHeader(const GURL& origin, |
| 42 const std::string& header_value) = 0; |
| 43 |
| 44 virtual void AddBinding(mojom::ReportingServiceRequest request) = 0; |
| 45 |
| 46 static std::unique_ptr<ReportingService> Create( |
| 47 scoped_refptr<net::URLRequestContextGetter> context, |
| 48 const base::Callback<bool(const GURL&)>& is_origin_secure); |
| 49 |
| 50 protected: |
| 51 ReportingService(); |
| 52 |
| 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(ReportingService); |
| 55 }; |
| 56 |
| 57 } // namespace reporting |
| 58 |
| 59 #endif // COMPONENTS_REPORTING_CORE_BROWSER_REPORTING_SERVICE_H_ |
OLD | NEW |