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, |
darin (slow to review)
2012/02/28 23:36:44
So GlobalRequestID is being used to track both URL
Takashi Toyoshima
2012/02/29 00:15:24
Yes.
WebSockets require one int value, socket_id_
| |
15 ResourceType::Type resource_type, | |
16 const net::SSLInfo& ssl_info, | 16 const net::SSLInfo& ssl_info, |
17 bool fatal) | 17 bool fatal) |
18 : SSLErrorHandler(rdh, request, resource_type), | 18 : SSLErrorHandler(delegate, id), |
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 fatal_(fatal) { | 21 fatal_(fatal) { |
22 DCHECK(request == resource_dispatcher_host_->GetURLRequest(request_id_)); | |
23 } | 22 } |
24 | 23 |
25 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { | 24 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() { |
26 return this; | 25 return this; |
27 } | 26 } |
28 | 27 |
29 void SSLCertErrorHandler::OnDispatchFailed() { | 28 void SSLCertErrorHandler::OnDispatchFailed() { |
30 // Requests that don't have a tab (i.e. requests from extensions) will fail | 29 // 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 | 30 // 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 | 31 // this case we have to make a decision in this function, so we ignore |
33 // revocation check failures. | 32 // revocation check failures. |
34 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { | 33 if (net::IsCertStatusMinorError(ssl_info().cert_status)) { |
35 ContinueRequest(); | 34 ContinueRequest(); |
36 } else { | 35 } else { |
37 CancelRequest(); | 36 CancelRequest(); |
38 } | 37 } |
39 } | 38 } |
40 | 39 |
41 void SSLCertErrorHandler::OnDispatched() { | 40 void SSLCertErrorHandler::OnDispatched() { |
42 manager_->policy()->OnCertError(this); | 41 manager_->policy()->OnCertError(this); |
43 } | 42 } |
44 | 43 |
45 SSLCertErrorHandler::~SSLCertErrorHandler() {} | 44 SSLCertErrorHandler::~SSLCertErrorHandler() {} |
OLD | NEW |