| 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> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // This class also observes SafeBrowsing preference changes to enable/disable | 53 // This class also observes SafeBrowsing preference changes to enable/disable |
| 54 // reporting. It does this by subscribing to changes in SafeBrowsing and | 54 // reporting. It does this by subscribing to changes in SafeBrowsing and |
| 55 // extended reporting preferences. | 55 // extended reporting preferences. |
| 56 class CertificateReportingService : public KeyedService { | 56 class CertificateReportingService : public KeyedService { |
| 57 public: | 57 public: |
| 58 // Represents a report to be sent. | 58 // Represents a report to be sent. |
| 59 struct Report { | 59 struct Report { |
| 60 int report_id; | 60 int report_id; |
| 61 base::Time creation_time; | 61 base::Time creation_time; |
| 62 std::string serialized_report; | 62 std::string serialized_report; |
| 63 bool is_retried; |
| 63 Report(int report_id, | 64 Report(int report_id, |
| 64 base::Time creation_time, | 65 base::Time creation_time, |
| 65 const std::string& serialized_report) | 66 const std::string& serialized_report) |
| 66 : report_id(report_id), | 67 : report_id(report_id), |
| 67 creation_time(creation_time), | 68 creation_time(creation_time), |
| 68 serialized_report(serialized_report) {} | 69 serialized_report(serialized_report), |
| 70 is_retried(false) {} |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 // This class contains a number of reports, sorted by the first time the | 73 // This class contains a number of reports, sorted by the first time the |
| 72 // report was to be sent. Oldest reports are at the end of the list. The | 74 // report was to be sent. Oldest reports are at the end of the list. The |
| 73 // number of reports are bounded by |max_size|. The implementation sorts all | 75 // number of reports are bounded by |max_size|. The implementation sorts all |
| 74 // items in the list whenever a new item is added. This should be fine for | 76 // items in the list whenever a new item is added. This should be fine for |
| 75 // small values of |max_size| (e.g. fewer than 100 items). In case this is not | 77 // small values of |max_size| (e.g. fewer than 100 items). In case this is not |
| 76 // sufficient in the future, an array based implementation should be | 78 // sufficient in the future, an array based implementation should be |
| 77 // considered where the array is maintained as a heap. | 79 // considered where the array is maintained as a heap. |
| 78 class BoundedReportList { | 80 class BoundedReportList { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 base::Callback<void()> reset_callback_; | 233 base::Callback<void()> reset_callback_; |
| 232 | 234 |
| 233 // Encryption parameters. | 235 // Encryption parameters. |
| 234 uint8_t* server_public_key_; | 236 uint8_t* server_public_key_; |
| 235 uint32_t server_public_key_version_; | 237 uint32_t server_public_key_version_; |
| 236 | 238 |
| 237 DISALLOW_COPY_AND_ASSIGN(CertificateReportingService); | 239 DISALLOW_COPY_AND_ASSIGN(CertificateReportingService); |
| 238 }; | 240 }; |
| 239 | 241 |
| 240 #endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ | 242 #endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ |
| OLD | NEW |