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