| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 5 #ifndef COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
| 6 #define COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 6 #define COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <set> | 11 #include <set> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "net/url_request/certificate_report_sender.h" | 15 #include "net/url_request/certificate_report_sender.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class URLRequestContext; | 19 class URLRequestContext; |
| 20 class SSLInfo; | 20 class SSLInfo; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace certificate_reporting { | 23 namespace certificate_reporting { |
| 24 | 24 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 const GURL& upload_url, | 37 const GURL& upload_url, |
| 38 net::CertificateReportSender::CookiesPreference cookies_preference); | 38 net::CertificateReportSender::CookiesPreference cookies_preference); |
| 39 | 39 |
| 40 // Allows tests to use a server public key with known private key and | 40 // Allows tests to use a server public key with known private key and |
| 41 // a mock CertificateReportSender. |server_public_key| must outlive | 41 // a mock CertificateReportSender. |server_public_key| must outlive |
| 42 // the ErrorReporter. | 42 // the ErrorReporter. |
| 43 ErrorReporter( | 43 ErrorReporter( |
| 44 const GURL& upload_url, | 44 const GURL& upload_url, |
| 45 const uint8_t server_public_key[/* 32 */], | 45 const uint8_t server_public_key[/* 32 */], |
| 46 const uint32_t server_public_key_version, | 46 const uint32_t server_public_key_version, |
| 47 scoped_ptr<net::CertificateReportSender> certificate_report_sender); | 47 std::unique_ptr<net::CertificateReportSender> certificate_report_sender); |
| 48 | 48 |
| 49 virtual ~ErrorReporter(); | 49 virtual ~ErrorReporter(); |
| 50 | 50 |
| 51 // Sends a certificate report to the report collection server. The | 51 // Sends a certificate report to the report collection server. The |
| 52 // |serialized_report| is expected to be a serialized protobuf | 52 // |serialized_report| is expected to be a serialized protobuf |
| 53 // containing information about the hostname, certificate chain, and | 53 // containing information about the hostname, certificate chain, and |
| 54 // certificate errors encountered when validating the chain. | 54 // certificate errors encountered when validating the chain. |
| 55 // | 55 // |
| 56 // |SendReport| actually sends the report over the network; callers are | 56 // |SendReport| actually sends the report over the network; callers are |
| 57 // responsible for enforcing any preconditions (such as obtaining user | 57 // responsible for enforcing any preconditions (such as obtaining user |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 // Whether sending reports over HTTP is supported. | 68 // Whether sending reports over HTTP is supported. |
| 69 static bool IsHttpUploadUrlSupported(); | 69 static bool IsHttpUploadUrlSupported(); |
| 70 | 70 |
| 71 // Used by tests. | 71 // Used by tests. |
| 72 static bool DecryptErrorReport( | 72 static bool DecryptErrorReport( |
| 73 const uint8_t server_private_key[32], | 73 const uint8_t server_private_key[32], |
| 74 const EncryptedCertLoggerRequest& encrypted_report, | 74 const EncryptedCertLoggerRequest& encrypted_report, |
| 75 std::string* decrypted_serialized_report); | 75 std::string* decrypted_serialized_report); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 scoped_ptr<net::CertificateReportSender> certificate_report_sender_; | 78 std::unique_ptr<net::CertificateReportSender> certificate_report_sender_; |
| 79 | 79 |
| 80 const GURL upload_url_; | 80 const GURL upload_url_; |
| 81 | 81 |
| 82 const uint8_t* server_public_key_; | 82 const uint8_t* server_public_key_; |
| 83 const uint32_t server_public_key_version_; | 83 const uint32_t server_public_key_version_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(ErrorReporter); | 85 DISALLOW_COPY_AND_ASSIGN(ErrorReporter); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace certificate_reporting | 88 } // namespace certificate_reporting |
| 89 | 89 |
| 90 #endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 90 #endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
| OLD | NEW |