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/renderer_host/resource_dispatcher_host_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 8 #include "content/browser/ssl/ssl_manager.h" |
8 #include "content/browser/ssl/ssl_policy.h" | 9 #include "content/browser/ssl/ssl_policy.h" |
9 #include "net/base/cert_status_flags.h" | 10 #include "net/base/cert_status_flags.h" |
10 #include "net/base/x509_certificate.h" | 11 #include "net/base/x509_certificate.h" |
11 | 12 |
12 using content::ResourceDispatcherHostImpl; | 13 using content::ResourceDispatcherHostImpl; |
13 | 14 |
14 SSLCertErrorHandler::SSLCertErrorHandler( | 15 SSLCertErrorHandler::SSLCertErrorHandler( |
15 ResourceDispatcherHostImpl* host, | 16 Delegate* delegate, |
16 net::URLRequest* request, | 17 const content::GlobalRequestID& id, |
17 ResourceType::Type resource_type, | 18 ResourceType::Type resource_type, |
| 19 const GURL& url, |
| 20 int render_process_id, |
| 21 int render_view_id, |
18 const net::SSLInfo& ssl_info, | 22 const net::SSLInfo& ssl_info, |
19 bool fatal) | 23 bool fatal) |
20 : SSLErrorHandler(host, request, resource_type), | 24 : SSLErrorHandler(delegate, id, resource_type, url, render_process_id, |
| 25 render_view_id), |
21 ssl_info_(ssl_info), | 26 ssl_info_(ssl_info), |
22 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), | 27 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), |
23 fatal_(fatal) { | 28 fatal_(fatal) { |
24 DCHECK(request == resource_dispatcher_host_->GetURLRequest(request_id_)); | |
25 } | 29 } |
26 | 30 |
27 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { | 31 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { |
28 return this; | 32 return this; |
29 } | 33 } |
30 | 34 |
31 void SSLCertErrorHandler::OnDispatchFailed() { | 35 void SSLCertErrorHandler::OnDispatchFailed() { |
32 // Requests that don't have a tab (i.e. requests from extensions) will fail | 36 // Requests that don't have a tab (i.e. requests from extensions) will fail |
33 // to dispatch because they don't have a TabContents. See crbug.com/86537. In | 37 // to dispatch because they don't have a TabContents. See crbug.com/86537. In |
34 // this case we have to make a decision in this function, so we ignore | 38 // this case we have to make a decision in this function, so we ignore |
35 // revocation check failures. | 39 // revocation check failures. |
36 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { | 40 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { |
37 ContinueRequest(); | 41 ContinueRequest(); |
38 } else { | 42 } else { |
39 CancelRequest(); | 43 CancelRequest(); |
40 } | 44 } |
41 } | 45 } |
42 | 46 |
43 void SSLCertErrorHandler::OnDispatched() { | 47 void SSLCertErrorHandler::OnDispatched() { |
44 manager_->policy()->OnCertError(this); | 48 manager_->policy()->OnCertError(this); |
45 } | 49 } |
46 | 50 |
47 SSLCertErrorHandler::~SSLCertErrorHandler() {} | 51 SSLCertErrorHandler::~SSLCertErrorHandler() {} |
OLD | NEW |