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 const GlobalRequestID& id, | 16 const GlobalRequestID& id, |
17 ResourceType::Type resource_type, | 17 ResourceType resource_type, |
18 const GURL& url, | 18 const GURL& url, |
19 int render_process_id, | 19 int render_process_id, |
20 int render_frame_id, | 20 int render_frame_id, |
21 const net::SSLInfo& ssl_info, | 21 const net::SSLInfo& ssl_info, |
22 bool fatal) | 22 bool fatal) |
23 : SSLErrorHandler(delegate, id, resource_type, url, render_process_id, | 23 : SSLErrorHandler(delegate, |
| 24 id, |
| 25 resource_type, |
| 26 url, |
| 27 render_process_id, |
24 render_frame_id), | 28 render_frame_id), |
25 ssl_info_(ssl_info), | 29 ssl_info_(ssl_info), |
26 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), | 30 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), |
27 fatal_(fatal) { | 31 fatal_(fatal) { |
28 } | 32 } |
29 | 33 |
30 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { | 34 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { |
31 return this; | 35 return this; |
32 } | 36 } |
33 | 37 |
34 void SSLCertErrorHandler::OnDispatchFailed() { | 38 void SSLCertErrorHandler::OnDispatchFailed() { |
35 // Requests can fail to dispatch because they don't have a WebContents. See | 39 // Requests can fail to dispatch because they don't have a WebContents. See |
36 // <http://crbug.com/86537>. In this case we have to make a decision in this | 40 // <http://crbug.com/86537>. In this case we have to make a decision in this |
37 // function, so we ignore revocation check failures. | 41 // function, so we ignore revocation check failures. |
38 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { | 42 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { |
39 ContinueRequest(); | 43 ContinueRequest(); |
40 } else { | 44 } else { |
41 CancelRequest(); | 45 CancelRequest(); |
42 } | 46 } |
43 } | 47 } |
44 | 48 |
45 void SSLCertErrorHandler::OnDispatched() { | 49 void SSLCertErrorHandler::OnDispatched() { |
46 manager_->policy()->OnCertError(this); | 50 manager_->policy()->OnCertError(this); |
47 } | 51 } |
48 | 52 |
49 SSLCertErrorHandler::~SSLCertErrorHandler() {} | 53 SSLCertErrorHandler::~SSLCertErrorHandler() {} |
50 | 54 |
51 } // namespace content | 55 } // namespace content |
OLD | NEW |