OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "net/url_request/fraudulent_certificate_reporter.h" |
| 13 #include "net/url_request/url_request.h" |
| 14 |
| 15 namespace chrome_browser_net { |
| 16 |
| 17 // TODO(palmer): Switch to HTTPS when the error handling delegate is more |
| 18 // sophisticated. Ultimately we plan to attempt the report on many transports. |
| 19 const char FRAUDULENT_CERTIFICATE_UPLOAD_ENDPOINT[] = |
| 20 "http://clients3.google.com/log_cert_error"; |
| 21 |
| 22 class ChromeFraudulentCertificateReporter |
| 23 : public net::FraudulentCertificateReporter, |
| 24 public net::URLRequest::Delegate { |
| 25 public: |
| 26 explicit ChromeFraudulentCertificateReporter( |
| 27 net::URLRequestContext* request_context); |
| 28 |
| 29 virtual ~ChromeFraudulentCertificateReporter(); |
| 30 |
| 31 // Allows users of this class to override this and set their own URLRequest |
| 32 // type. Used by SendReport. |
| 33 virtual net::URLRequest* CreateURLRequest(); |
| 34 |
| 35 // net::FraudulentCertificateReporter |
| 36 virtual void SendReport(const std::string& hostname, |
| 37 const net::SSLInfo& ssl_info, |
| 38 bool sni_available) OVERRIDE; |
| 39 |
| 40 // net::URLRequest::Delegate |
| 41 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
| 42 virtual void OnReadCompleted(net::URLRequest* request, |
| 43 int bytes_read) OVERRIDE; |
| 44 |
| 45 protected: |
| 46 net::URLRequestContext* const request_context_; |
| 47 |
| 48 private: |
| 49 // Performs post-report cleanup. |
| 50 void RequestComplete(net::URLRequest* request); |
| 51 |
| 52 const GURL upload_url_; |
| 53 std::set<net::URLRequest*> inflight_requests_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ChromeFraudulentCertificateReporter); |
| 56 }; |
| 57 |
| 58 } // namespace chrome_browser_net |
| 59 |
| 60 #endif // CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_ |
| 61 |
OLD | NEW |