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