• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "chrome/browser/ssl/ssl_cert_error_handler.h"
6 
7 #include "chrome/browser/ssl/ssl_manager.h"
8 #include "chrome/browser/ssl/ssl_policy.h"
9 #include "content/browser/renderer_host/resource_dispatcher_host.h"
10 #include "net/base/x509_certificate.h"
11 
SSLCertErrorHandler(ResourceDispatcherHost * rdh,net::URLRequest * request,ResourceType::Type resource_type,int cert_error,net::X509Certificate * cert)12 SSLCertErrorHandler::SSLCertErrorHandler(
13     ResourceDispatcherHost* rdh,
14     net::URLRequest* request,
15     ResourceType::Type resource_type,
16     int cert_error,
17     net::X509Certificate* cert)
18     : SSLErrorHandler(rdh, request, resource_type),
19       cert_error_(cert_error) {
20   DCHECK(request == resource_dispatcher_host_->GetURLRequest(request_id_));
21 
22   // We cannot use the request->ssl_info(), it's not been initialized yet, so
23   // we have to set the fields manually.
24   ssl_info_.cert = cert;
25   ssl_info_.SetCertError(cert_error);
26 }
27 
AsSSLCertErrorHandler()28 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() {
29   return this;
30 }
31 
OnDispatchFailed()32 void SSLCertErrorHandler::OnDispatchFailed() {
33   CancelRequest();
34 }
35 
OnDispatched()36 void SSLCertErrorHandler::OnDispatched() {
37   manager_->policy()->OnCertError(this);
38 }
39 
~SSLCertErrorHandler()40 SSLCertErrorHandler::~SSLCertErrorHandler() {}
41