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 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 // A CertError represents an error that occurred with the certificate in an | 14 // A CertError represents an error that occurred with the certificate in an |
15 // SSL session. A CertError object exists both on the IO thread and on the UI | 15 // SSL session. A CertError object exists both on the IO thread and on the UI |
16 // thread and allows us to cancel/continue a request it is associated with. | 16 // thread and allows us to cancel/continue a request it is associated with. |
17 class SSLCertErrorHandler : public SSLErrorHandler { | 17 class SSLCertErrorHandler : public SSLErrorHandler { |
18 public: | 18 public: |
19 // Construct on the IO thread. | 19 // Construct on the IO thread. |
20 SSLCertErrorHandler(ResourceDispatcherHost* rdh, | 20 SSLCertErrorHandler(ResourceDispatcherHost* rdh, |
21 net::URLRequest* request, | 21 net::URLRequest* request, |
22 ResourceType::Type resource_type, | 22 ResourceType::Type resource_type, |
23 const net::SSLInfo& ssl_info, | 23 const net::SSLInfo& ssl_info, |
24 bool is_hsts_host); | 24 bool fatal); |
25 | 25 |
26 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() OVERRIDE; | 26 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() OVERRIDE; |
27 | 27 |
28 // These accessors are available on either thread | 28 // These accessors are available on either thread |
29 const net::SSLInfo& ssl_info() const { return ssl_info_; } | 29 const net::SSLInfo& ssl_info() const { return ssl_info_; } |
30 int cert_error() const { return cert_error_; } | 30 int cert_error() const { return cert_error_; } |
31 bool is_hsts_host() const { return is_hsts_host_; } | 31 bool fatal() const { return fatal_; } |
32 | 32 |
33 protected: | 33 protected: |
34 // SSLErrorHandler methods | 34 // SSLErrorHandler methods |
35 virtual void OnDispatchFailed() OVERRIDE; | 35 virtual void OnDispatchFailed() OVERRIDE; |
36 virtual void OnDispatched() OVERRIDE; | 36 virtual void OnDispatched() OVERRIDE; |
37 | 37 |
38 private: | 38 private: |
39 virtual ~SSLCertErrorHandler(); | 39 virtual ~SSLCertErrorHandler(); |
40 | 40 |
41 // These read-only members may be accessed on any thread. | 41 // These read-only members may be accessed on any thread. |
42 const net::SSLInfo ssl_info_; | 42 const net::SSLInfo ssl_info_; |
43 const int cert_error_; // The error we represent. | 43 const int cert_error_; // The error we represent. |
44 const bool is_hsts_host_; // true if the error is from an HSTS host. | 44 const bool fatal_; // True if the error is from a host requiring |
| 45 // certificate errors to be fatal. |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); | 47 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); |
47 }; | 48 }; |
48 | 49 |
49 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 50 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
OLD | NEW |