OLD | NEW |
---|---|
1 // Copyright (c) 2011 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.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.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 SSLCertErrorHandler::SSLCertErrorHandler( | 13 SSLCertErrorHandler::SSLCertErrorHandler( |
13 ResourceDispatcherHost* rdh, | 14 Delegate* delegate, |
14 net::URLRequest* request, | 15 const content::GlobalRequestID& id, |
15 ResourceType::Type resource_type, | 16 ResourceType::Type resource_type, |
17 const GURL& url, | |
18 int render_process_id, | |
darin (slow to review)
2012/03/09 20:49:03
it actually looks like we only need the render_pro
Takashi Toyoshima
2012/03/10 00:24:44
WebSocket doesn't use URLRequest.
Removing it from
| |
19 int render_view_id, | |
16 const net::SSLInfo& ssl_info, | 20 const net::SSLInfo& ssl_info, |
17 bool fatal) | 21 bool fatal) |
18 : SSLErrorHandler(rdh, request, resource_type), | 22 : SSLErrorHandler(delegate, id, resource_type, url, render_process_id, |
23 render_view_id), | |
19 ssl_info_(ssl_info), | 24 ssl_info_(ssl_info), |
20 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), | 25 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)), |
21 fatal_(fatal) { | 26 fatal_(fatal) { |
22 DCHECK(request == resource_dispatcher_host_->GetURLRequest(request_id_)); | |
23 } | 27 } |
24 | 28 |
25 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { | 29 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { |
26 return this; | 30 return this; |
27 } | 31 } |
28 | 32 |
29 void SSLCertErrorHandler::OnDispatchFailed() { | 33 void SSLCertErrorHandler::OnDispatchFailed() { |
30 // Requests that don't have a tab (i.e. requests from extensions) will fail | 34 // 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 | 35 // 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 | 36 // this case we have to make a decision in this function, so we ignore |
33 // revocation check failures. | 37 // revocation check failures. |
34 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { | 38 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { |
35 ContinueRequest(); | 39 ContinueRequest(); |
36 } else { | 40 } else { |
37 CancelRequest(); | 41 CancelRequest(); |
38 } | 42 } |
39 } | 43 } |
40 | 44 |
41 void SSLCertErrorHandler::OnDispatched() { | 45 void SSLCertErrorHandler::OnDispatched() { |
42 manager_->policy()->OnCertError(this); | 46 manager_->policy()->OnCertError(this); |
43 } | 47 } |
44 | 48 |
45 SSLCertErrorHandler::~SSLCertErrorHandler() {} | 49 SSLCertErrorHandler::~SSLCertErrorHandler() {} |
OLD | NEW |