OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl/ssl_manager.h" | 7 #include "content/browser/ssl/ssl_manager.h" |
8 #include "content/browser/ssl/ssl_policy.h" | 8 #include "content/browser/ssl/ssl_policy.h" |
9 #include "net/cert/cert_status_flags.h" | 9 #include "net/cert/cert_status_flags.h" |
10 #include "net/cert/x509_certificate.h" | 10 #include "net/cert/x509_certificate.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 SSLCertErrorHandler::SSLCertErrorHandler( | 14 SSLCertErrorHandler::SSLCertErrorHandler( |
15 const base::WeakPtr<Delegate>& delegate, | 15 const base::WeakPtr<Delegate>& delegate, |
16 ResourceType resource_type, | 16 ResourceType resource_type, |
17 const GURL& url, | 17 const GURL& url, |
18 int render_process_id, | 18 const ResourceRequestInfo::WebContentsGetterOnUI& web_contents_getter, |
19 int render_frame_id, | |
20 const net::SSLInfo& ssl_info, | 19 const net::SSLInfo& ssl_info, |
21 bool fatal) | 20 bool fatal) |
22 : SSLErrorHandler(delegate, | 21 : SSLErrorHandler(delegate, |
23 resource_type, | 22 resource_type, |
24 url, | 23 url, |
25 render_process_id, | 24 web_contents_getter), |
26 render_frame_id), | |
27 ssl_info_(ssl_info), | 25 ssl_info_(ssl_info), |
28 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), | 26 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), |
29 fatal_(fatal) { | 27 fatal_(fatal) {} |
30 } | |
31 | 28 |
32 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { | 29 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { |
33 return this; | 30 return this; |
34 } | 31 } |
35 | 32 |
36 void SSLCertErrorHandler::OnDispatchFailed() { | 33 void SSLCertErrorHandler::OnDispatchFailed() { |
37 // Requests can fail to dispatch because they don't have a WebContents. See | 34 // Requests can fail to dispatch because they don't have a WebContents. See |
38 // <http://crbug.com/86537>. In this case we have to make a decision in this | 35 // <http://crbug.com/86537>. In this case we have to make a decision in this |
39 // function, so we ignore revocation check failures. | 36 // function, so we ignore revocation check failures. |
40 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { | 37 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { |
41 ContinueRequest(); | 38 ContinueRequest(); |
42 } else { | 39 } else { |
43 CancelRequest(); | 40 CancelRequest(); |
44 } | 41 } |
45 } | 42 } |
46 | 43 |
47 void SSLCertErrorHandler::OnDispatched() { | 44 void SSLCertErrorHandler::OnDispatched() { |
48 manager_->policy()->OnCertError(this); | 45 manager_->policy()->OnCertError(this); |
49 } | 46 } |
50 | 47 |
51 SSLCertErrorHandler::~SSLCertErrorHandler() {} | 48 SSLCertErrorHandler::~SSLCertErrorHandler() {} |
52 | 49 |
53 } // namespace content | 50 } // namespace content |
OLD | NEW |