Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ | 6 #define CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/net/certificate_error_reporter.h" | |
| 11 #include "net/url_request/fraudulent_certificate_reporter.h" | 12 #include "net/url_request/fraudulent_certificate_reporter.h" |
| 12 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 class URLRequestContext; | 16 class URLRequestContext; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace chrome_browser_net { | 19 namespace chrome_browser_net { |
| 19 | 20 |
| 20 class ChromeFraudulentCertificateReporter | 21 class ChromeFraudulentCertificateReporter |
| 21 : public net::FraudulentCertificateReporter, | 22 : public net::FraudulentCertificateReporter, |
| 22 public net::URLRequest::Delegate { | 23 public net::URLRequest::Delegate { |
|
Ryan Sleevi
2015/03/06 19:23:13
You no longer need to be a net::URLRequest::Delega
estark
2015/03/06 20:10:03
Done.
| |
| 23 public: | 24 public: |
| 24 explicit ChromeFraudulentCertificateReporter( | 25 explicit ChromeFraudulentCertificateReporter( |
| 25 net::URLRequestContext* request_context); | 26 net::URLRequestContext* request_context); |
| 26 | 27 |
| 27 ~ChromeFraudulentCertificateReporter() override; | 28 // A constructor used by tests to set certificate_reporter_ to a mock |
| 29 // reporter. | |
| 30 explicit ChromeFraudulentCertificateReporter( | |
| 31 scoped_ptr<CertificateErrorReporter> certificate_reporter); | |
|
Ryan Sleevi
2015/03/06 19:23:14
Then you can make this constructor private and fri
estark
2015/03/06 19:52:06
Friending ChromeFraudulentCertificateReporterTest
| |
| 28 | 32 |
| 29 // Allows users of this class to override this and set their own URLRequest | 33 ~ChromeFraudulentCertificateReporter() override {} |
| 30 // type. Used by SendReport. | |
| 31 virtual scoped_ptr<net::URLRequest> CreateURLRequest( | |
| 32 net::URLRequestContext* context); | |
| 33 | 34 |
| 34 // net::FraudulentCertificateReporter | 35 // net::FraudulentCertificateReporter |
| 35 void SendReport(const std::string& hostname, | 36 void SendReport(const std::string& hostname, |
| 36 const net::SSLInfo& ssl_info) override; | 37 const net::SSLInfo& ssl_info) override; |
| 37 | 38 |
| 38 // net::URLRequest::Delegate | 39 // net::URLRequest::Delegate |
| 39 void OnResponseStarted(net::URLRequest* request) override; | 40 void OnResponseStarted(net::URLRequest* request) override; |
| 40 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | 41 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
|
Ryan Sleevi
2015/03/06 19:23:13
You can delete these two methods
estark
2015/03/06 20:10:03
Done.
| |
| 41 | 42 |
| 42 protected: | |
| 43 net::URLRequestContext* const request_context_; | |
| 44 | |
| 45 private: | 43 private: |
| 46 // Performs post-report cleanup. | 44 scoped_ptr<CertificateErrorReporter> certificate_reporter_; |
| 47 void RequestComplete(net::URLRequest* request); | |
| 48 | |
| 49 const GURL upload_url_; | |
| 50 // Owns the contained requests. | |
| 51 std::set<net::URLRequest*> inflight_requests_; | |
| 52 | 45 |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromeFraudulentCertificateReporter); | 46 DISALLOW_COPY_AND_ASSIGN(ChromeFraudulentCertificateReporter); |
| 54 }; | 47 }; |
| 55 | 48 |
| 56 } // namespace chrome_browser_net | 49 } // namespace chrome_browser_net |
| 57 | 50 |
| 58 #endif // CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ | 51 #endif // CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
| 59 | |
| OLD | NEW |