| 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 CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
| 6 #define CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/ssl/ssl_error_handler.h" | 10 #include "chrome/browser/ssl/ssl_error_handler.h" |
| 11 #include "net/base/ssl_info.h" | 11 #include "net/base/ssl_info.h" |
| 12 #include "net/base/x509_certificate.h" | 12 #include "net/base/x509_certificate.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 URLRequest* request, | 21 URLRequest* request, |
| 22 ResourceType::Type resource_type, | 22 ResourceType::Type resource_type, |
| 23 const std::string& frame_origin, | 23 const std::string& frame_origin, |
| 24 const std::string& main_frame_origin, | 24 const std::string& main_frame_origin, |
| 25 int cert_error, | 25 int cert_error, |
| 26 net::X509Certificate* cert, | 26 net::X509Certificate* cert); |
| 27 MessageLoop* ui_loop); | |
| 28 | 27 |
| 29 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() { return this; } | 28 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() { return this; } |
| 30 | 29 |
| 31 // These accessors are available on either thread | 30 // These accessors are available on either thread |
| 32 const net::SSLInfo& ssl_info() const { return ssl_info_; } | 31 const net::SSLInfo& ssl_info() const { return ssl_info_; } |
| 33 int cert_error() const { return cert_error_; } | 32 int cert_error() const { return cert_error_; } |
| 34 | 33 |
| 35 protected: | 34 protected: |
| 36 // SSLErrorHandler methods | 35 // SSLErrorHandler methods |
| 37 virtual void OnDispatchFailed(); | 36 virtual void OnDispatchFailed(); |
| 38 virtual void OnDispatched(); | 37 virtual void OnDispatched(); |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 // These read-only members may be accessed on any thread. | 40 // These read-only members may be accessed on any thread. |
| 42 net::SSLInfo ssl_info_; | 41 net::SSLInfo ssl_info_; |
| 43 const int cert_error_; // The error we represent. | 42 const int cert_error_; // The error we represent. |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); | 44 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 #endif // CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 47 #endif // CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
| OLD | NEW |