OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/ssl/ssl_cert_error_handler.h" | 5 #include "content/browser/ssl/ssl_cert_error_handler.h" |
6 | 6 |
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 #include "content/browser/ssl/ssl_policy.h" | 8 #include "content/browser/ssl/ssl_policy.h" |
9 #include "net/base/cert_status_flags.h" | 9 #include "net/base/cert_status_flags.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 net::URLRequest* request, | 14 net::URLRequest* request, |
15 ResourceType::Type resource_type, | 15 ResourceType::Type resource_type, |
16 const net::SSLInfo& ssl_info, | 16 const net::SSLInfo& ssl_info, |
17 bool is_hsts_host) | 17 bool fatal) |
18 : SSLErrorHandler(rdh, request, resource_type), | 18 : SSLErrorHandler(rdh, request, resource_type), |
19 ssl_info_(ssl_info), | 19 ssl_info_(ssl_info), |
20 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), | 20 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), |
21 is_hsts_host_(is_hsts_host) { | 21 fatal_(fatal) { |
22 DCHECK(request == resource_dispatcher_host_->GetURLRequest(request_id_)); | 22 DCHECK(request == resource_dispatcher_host_->GetURLRequest(request_id_)); |
23 } | 23 } |
24 | 24 |
25 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { | 25 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { |
26 return this; | 26 return this; |
27 } | 27 } |
28 | 28 |
29 void SSLCertErrorHandler::OnDispatchFailed() { | 29 void SSLCertErrorHandler::OnDispatchFailed() { |
30 // Requests that don't have a tab (i.e. requests from extensions) will fail | 30 // Requests that don't have a tab (i.e. requests from extensions) will fail |
31 // to dispatch because they don't have a TabContents. See crbug.com/86537. In | 31 // to dispatch because they don't have a TabContents. See crbug.com/86537. In |
32 // this case we have to make a decision in this function, so we ignore | 32 // this case we have to make a decision in this function, so we ignore |
33 // revocation check failures. | 33 // revocation check failures. |
34 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { | 34 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { |
35 ContinueRequest(); | 35 ContinueRequest(); |
36 } else { | 36 } else { |
37 CancelRequest(); | 37 CancelRequest(); |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 void SSLCertErrorHandler::OnDispatched() { | 41 void SSLCertErrorHandler::OnDispatched() { |
42 manager_->policy()->OnCertError(this); | 42 manager_->policy()->OnCertError(this); |
43 } | 43 } |
44 | 44 |
45 SSLCertErrorHandler::~SSLCertErrorHandler() {} | 45 SSLCertErrorHandler::~SSLCertErrorHandler() {} |
OLD | NEW |