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