| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "components/certificate_reporting/error_reporter.h" | 17 #include "components/certificate_reporting/error_reporter.h" |
| 18 #include "components/keyed_service/core/keyed_service.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class Clock; | 21 class Clock; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // This service initiates uploads of invalid certificate reports and retries any | 24 // This service initiates uploads of invalid certificate reports and retries any |
| 24 // failed uploads. | 25 // failed uploads. |
| 25 class CertificateReportingService { | 26 class CertificateReportingService : public KeyedService { |
| 26 public: | 27 public: |
| 27 // Represent a report to be sent. | 28 // Represent a report to be sent. |
| 28 struct Report { | 29 struct Report { |
| 29 int report_id; | 30 int report_id; |
| 30 base::Time creation_time; | 31 base::Time creation_time; |
| 31 std::string serialized_report; | 32 std::string serialized_report; |
| 32 Report(int report_id, | 33 Report(int report_id, |
| 33 base::Time creation_time, | 34 base::Time creation_time, |
| 34 const std::string& serialized_report) | 35 const std::string& serialized_report) |
| 35 : report_id(report_id), | 36 : report_id(report_id), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 102 |
| 102 std::map<int, Report> inflight_reports_; | 103 std::map<int, Report> inflight_reports_; |
| 103 | 104 |
| 104 base::WeakPtrFactory<Reporter> weak_factory_; | 105 base::WeakPtrFactory<Reporter> weak_factory_; |
| 105 | 106 |
| 106 DISALLOW_IMPLICIT_CONSTRUCTORS(Reporter); | 107 DISALLOW_IMPLICIT_CONSTRUCTORS(Reporter); |
| 107 }; | 108 }; |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 #endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ | 111 #endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ |
| OLD | NEW |