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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "net/url_request/fraudulent_certificate_reporter.h" | 12 #include "net/url_request/fraudulent_certificate_reporter.h" |
13 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
14 | 14 |
| 15 namespace net { |
| 16 class URLRequestContext; |
| 17 } |
| 18 |
15 namespace chrome_browser_net { | 19 namespace chrome_browser_net { |
16 | 20 |
17 class ChromeFraudulentCertificateReporter | 21 class ChromeFraudulentCertificateReporter |
18 : public net::FraudulentCertificateReporter, | 22 : public net::FraudulentCertificateReporter, |
19 public net::URLRequest::Delegate { | 23 public net::URLRequest::Delegate { |
20 public: | 24 public: |
21 explicit ChromeFraudulentCertificateReporter( | 25 explicit ChromeFraudulentCertificateReporter( |
22 net::URLRequestContext* request_context); | 26 net::URLRequestContext* request_context); |
23 | 27 |
24 virtual ~ChromeFraudulentCertificateReporter(); | 28 virtual ~ChromeFraudulentCertificateReporter(); |
25 | 29 |
26 // Allows users of this class to override this and set their own URLRequest | 30 // Allows users of this class to override this and set their own URLRequest |
27 // type. Used by SendReport. | 31 // type. Used by SendReport. |
28 virtual net::URLRequest* CreateURLRequest(); | 32 virtual net::URLRequest* CreateURLRequest(net::URLRequestContext* context); |
29 | 33 |
30 // net::FraudulentCertificateReporter | 34 // net::FraudulentCertificateReporter |
31 virtual void SendReport(const std::string& hostname, | 35 virtual void SendReport(const std::string& hostname, |
32 const net::SSLInfo& ssl_info, | 36 const net::SSLInfo& ssl_info, |
33 bool sni_available) OVERRIDE; | 37 bool sni_available) OVERRIDE; |
34 | 38 |
35 // net::URLRequest::Delegate | 39 // net::URLRequest::Delegate |
36 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; | 40 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
37 virtual void OnReadCompleted(net::URLRequest* request, | 41 virtual void OnReadCompleted(net::URLRequest* request, |
38 int bytes_read) OVERRIDE; | 42 int bytes_read) OVERRIDE; |
39 | 43 |
40 protected: | 44 protected: |
41 net::URLRequestContext* const request_context_; | 45 net::URLRequestContext* const request_context_; |
42 | 46 |
43 private: | 47 private: |
44 // Performs post-report cleanup. | 48 // Performs post-report cleanup. |
45 void RequestComplete(net::URLRequest* request); | 49 void RequestComplete(net::URLRequest* request); |
46 | 50 |
47 const GURL upload_url_; | 51 const GURL upload_url_; |
48 std::set<net::URLRequest*> inflight_requests_; | 52 std::set<net::URLRequest*> inflight_requests_; |
49 | 53 |
50 DISALLOW_COPY_AND_ASSIGN(ChromeFraudulentCertificateReporter); | 54 DISALLOW_COPY_AND_ASSIGN(ChromeFraudulentCertificateReporter); |
51 }; | 55 }; |
52 | 56 |
53 } // namespace chrome_browser_net | 57 } // namespace chrome_browser_net |
54 | 58 |
55 #endif // CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ | 59 #endif // CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
56 | 60 |
OLD | NEW |