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 <memory> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // | 53 // |
54 // |SendReport| actually sends the report over the network; callers are | 54 // |SendReport| actually sends the report over the network; callers are |
55 // responsible for enforcing any preconditions (such as obtaining user | 55 // responsible for enforcing any preconditions (such as obtaining user |
56 // opt-in, only sending reports for certain hostnames, checking for | 56 // opt-in, only sending reports for certain hostnames, checking for |
57 // incognito mode, etc.). | 57 // incognito mode, etc.). |
58 // | 58 // |
59 // On some platforms (but not all), ErrorReporter can use | 59 // On some platforms (but not all), ErrorReporter can use |
60 // an HTTP endpoint to send encrypted extended reporting reports. On | 60 // an HTTP endpoint to send encrypted extended reporting reports. On |
61 // unsupported platforms, callers must send extended reporting reports | 61 // unsupported platforms, callers must send extended reporting reports |
62 // over SSL. | 62 // over SSL. |
| 63 // |
| 64 // |
| 65 // Calls |success_callback| when the report is successfully sent and the |
| 66 // server returns an HTTP 200 response. |
| 67 // In all other cases, calls |error_callback| with the URL of the upload, |
| 68 // net error and HTTP response code parameters. |
63 virtual void SendExtendedReportingReport( | 69 virtual void SendExtendedReportingReport( |
64 const std::string& serialized_report, | 70 const std::string& serialized_report, |
65 const base::Callback<void()>& success_callback, | 71 const base::Callback<void()>& success_callback, |
66 const base::Callback<void(const GURL&, int)>& error_callback); | 72 const base::Callback<void(const GURL&, |
| 73 int /* net_error */, |
| 74 int /* http_response_code */)>& error_callback); |
67 | 75 |
68 // Used by tests. | 76 // Used by tests. |
69 static bool DecryptErrorReport( | 77 static bool DecryptErrorReport( |
70 const uint8_t server_private_key[32], | 78 const uint8_t server_private_key[32], |
71 const EncryptedCertLoggerRequest& encrypted_report, | 79 const EncryptedCertLoggerRequest& encrypted_report, |
72 std::string* decrypted_serialized_report); | 80 std::string* decrypted_serialized_report); |
73 | 81 |
74 void set_upload_url_for_testing(const GURL& url) { upload_url_ = url; } | 82 void set_upload_url_for_testing(const GURL& url) { upload_url_ = url; } |
75 | 83 |
76 private: | 84 private: |
77 std::unique_ptr<net::ReportSender> certificate_report_sender_; | 85 std::unique_ptr<net::ReportSender> certificate_report_sender_; |
78 | 86 |
79 GURL upload_url_; | 87 GURL upload_url_; |
80 | 88 |
81 const uint8_t* server_public_key_; | 89 const uint8_t* server_public_key_; |
82 const uint32_t server_public_key_version_; | 90 const uint32_t server_public_key_version_; |
83 | 91 |
84 DISALLOW_COPY_AND_ASSIGN(ErrorReporter); | 92 DISALLOW_COPY_AND_ASSIGN(ErrorReporter); |
85 }; | 93 }; |
86 | 94 |
87 } // namespace certificate_reporting | 95 } // namespace certificate_reporting |
88 | 96 |
89 #endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 97 #endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
OLD | NEW |