ssl_cert_error_handler.h revision 731df977c0511bca2206b5f333555b1205ff1f43
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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ 6#define CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ 7#pragma once 8 9#include <string> 10 11#include "chrome/browser/ssl/ssl_error_handler.h" 12#include "net/base/ssl_info.h" 13 14namespace net { 15class X509Certificate; 16} 17 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 20// thread and allows us to cancel/continue a request it is associated with. 21class SSLCertErrorHandler : public SSLErrorHandler { 22 public: 23 // Construct on the IO thread. 24 SSLCertErrorHandler(ResourceDispatcherHost* rdh, 25 URLRequest* request, 26 ResourceType::Type resource_type, 27 const std::string& frame_origin, 28 const std::string& main_frame_origin, 29 int cert_error, 30 net::X509Certificate* cert); 31 32 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() { return this; } 33 34 // These accessors are available on either thread 35 const net::SSLInfo& ssl_info() const { return ssl_info_; } 36 int cert_error() const { return cert_error_; } 37 38 protected: 39 // SSLErrorHandler methods 40 virtual void OnDispatchFailed(); 41 virtual void OnDispatched(); 42 43 private: 44 virtual ~SSLCertErrorHandler(); 45 46 // These read-only members may be accessed on any thread. 47 net::SSLInfo ssl_info_; 48 const int cert_error_; // The error we represent. 49 50 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); 51}; 52 53#endif // CHROME_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ 54