OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
6 #define CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 6 #define CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "content/browser/ssl/ssl_error_handler.h" | 11 #include "content/browser/ssl/ssl_error_handler.h" |
12 #include "net/base/ssl_info.h" | 12 #include "net/base/ssl_info.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 class X509Certificate; | 15 class X509Certificate; |
16 } | 16 } |
17 | 17 |
18 // A CertError represents an error that occurred with the certificate in an | 18 // A CertError represents an error that occurred with the certificate in an |
19 // SSL session. A CertError object exists both on the IO thread and on the UI | 19 // SSL session. A CertError object exists both on the IO thread and on the UI |
20 // thread and allows us to cancel/continue a request it is associated with. | 20 // thread and allows us to cancel/continue a request it is associated with. |
21 class SSLCertErrorHandler : public SSLErrorHandler { | 21 class SSLCertErrorHandler : public SSLErrorHandler { |
22 public: | 22 public: |
23 // Construct on the IO thread. | 23 // Construct on the IO thread. |
24 SSLCertErrorHandler(ResourceDispatcherHost* rdh, | 24 SSLCertErrorHandler(ResourceDispatcherHost* rdh, |
25 net::URLRequest* request, | 25 net::URLRequest* request, |
26 ResourceType::Type resource_type, | 26 ResourceType::Type resource_type, |
27 int cert_error, | 27 int cert_error, |
28 net::X509Certificate* cert); | 28 const net::SSLInfo& ssl_info, |
29 bool must_be_fatal); | |
29 | 30 |
30 virtual SSLCertErrorHandler* AsSSLCertErrorHandler(); | 31 virtual SSLCertErrorHandler* AsSSLCertErrorHandler(); |
31 | 32 |
32 // These accessors are available on either thread | 33 // These accessors are available on either thread |
33 const net::SSLInfo& ssl_info() const { return ssl_info_; } | 34 const net::SSLInfo& ssl_info() const { return ssl_info_; } |
34 int cert_error() const { return cert_error_; } | 35 int cert_error() const { return cert_error_; } |
36 bool must_be_fatal() const { return must_be_fatal_; } | |
35 | 37 |
36 protected: | 38 protected: |
37 // SSLErrorHandler methods | 39 // SSLErrorHandler methods |
38 virtual void OnDispatchFailed(); | 40 virtual void OnDispatchFailed(); |
39 virtual void OnDispatched(); | 41 virtual void OnDispatched(); |
40 | 42 |
41 private: | 43 private: |
42 virtual ~SSLCertErrorHandler(); | 44 virtual ~SSLCertErrorHandler(); |
43 | 45 |
44 // These read-only members may be accessed on any thread. | 46 // These read-only members may be accessed on any thread. |
45 net::SSLInfo ssl_info_; | 47 const net::SSLInfo ssl_info_; |
46 const int cert_error_; // The error we represent. | 48 const int cert_error_; // The error we represent. |
49 const bool must_be_fatal_; // true if the error is from an HSTS host. | |
wtc
2011/09/23 00:04:51
To be precise, this should also say "and the error
| |
47 | 50 |
48 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); | 51 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); |
49 }; | 52 }; |
50 | 53 |
51 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 54 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
OLD | NEW |