| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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(content::ResourceDispatcherHostImpl* host, | 20 SSLCertErrorHandler(Delegate* delegate, |
| 21 net::URLRequest* request, | 21 const content::GlobalRequestID& id, |
| 22 ResourceType::Type resource_type, | 22 ResourceType::Type resource_type, |
| 23 const GURL& url, |
| 24 int render_process_id, |
| 25 int render_view_id, |
| 23 const net::SSLInfo& ssl_info, | 26 const net::SSLInfo& ssl_info, |
| 24 bool fatal); | 27 bool fatal); |
| 25 | 28 |
| 26 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() OVERRIDE; | 29 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() OVERRIDE; |
| 27 | 30 |
| 28 // These accessors are available on either thread | 31 // These accessors are available on either thread |
| 29 const net::SSLInfo& ssl_info() const { return ssl_info_; } | 32 const net::SSLInfo& ssl_info() const { return ssl_info_; } |
| 30 int cert_error() const { return cert_error_; } | 33 int cert_error() const { return cert_error_; } |
| 31 bool fatal() const { return fatal_; } | 34 bool fatal() const { return fatal_; } |
| 32 | 35 |
| 33 protected: | 36 protected: |
| 34 // SSLErrorHandler methods | 37 // SSLErrorHandler methods |
| 35 virtual void OnDispatchFailed() OVERRIDE; | 38 virtual void OnDispatchFailed() OVERRIDE; |
| 36 virtual void OnDispatched() OVERRIDE; | 39 virtual void OnDispatched() OVERRIDE; |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 virtual ~SSLCertErrorHandler(); | 42 virtual ~SSLCertErrorHandler(); |
| 40 | 43 |
| 41 // These read-only members may be accessed on any thread. | 44 // These read-only members may be accessed on any thread. |
| 42 const net::SSLInfo ssl_info_; | 45 const net::SSLInfo ssl_info_; |
| 43 const int cert_error_; // The error we represent. | 46 const int cert_error_; // The error we represent. |
| 44 const bool fatal_; // True if the error is from a host requiring | 47 const bool fatal_; // True if the error is from a host requiring |
| 45 // certificate errors to be fatal. | 48 // certificate errors to be fatal. |
| 46 | 49 |
| 47 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); | 50 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ | 53 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ |
| OLD | NEW |