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.
5 #ifndef CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_
6 #define CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_
11 #include "net/url_request/fraudulent_certificate_reporter.h"
12 #include "net/url_request/url_request.h"
15 class URLRequestContext
;
18 namespace chrome_browser_net
{
20 class ChromeFraudulentCertificateReporter
21 : public net::FraudulentCertificateReporter
,
22 public net::URLRequest::Delegate
{
24 explicit ChromeFraudulentCertificateReporter(
25 net::URLRequestContext
* request_context
);
27 virtual ~ChromeFraudulentCertificateReporter();
29 // Allows users of this class to override this and set their own URLRequest
30 // type. Used by SendReport.
31 virtual scoped_ptr
<net::URLRequest
> CreateURLRequest(
32 net::URLRequestContext
* context
);
34 // net::FraudulentCertificateReporter
35 virtual void SendReport(const std::string
& hostname
,
36 const net::SSLInfo
& ssl_info
,
37 bool sni_available
) OVERRIDE
;
39 // net::URLRequest::Delegate
40 virtual void OnResponseStarted(net::URLRequest
* request
) OVERRIDE
;
41 virtual void OnReadCompleted(net::URLRequest
* request
,
42 int bytes_read
) OVERRIDE
;
45 net::URLRequestContext
* const request_context_
;
48 // Performs post-report cleanup.
49 void RequestComplete(net::URLRequest
* request
);
51 const GURL upload_url_
;
52 // Owns the contained requests.
53 std::set
<net::URLRequest
*> inflight_requests_
;
55 DISALLOW_COPY_AND_ASSIGN(ChromeFraudulentCertificateReporter
);
58 } // namespace chrome_browser_net
60 #endif // CHROME_BROWSER_NET_CHROME_FRAUDULENT_CERTIFICATE_REPORTER_H_