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_manager.h" | 5 #include "content/browser/ssl/ssl_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "content/browser/load_from_memory_cache_details.h" | 9 #include "content/browser/load_from_memory_cache_details.h" |
10 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 10 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
(...skipping 12 matching lines...) Expand all Loading... |
24 #include "content/public/common/ssl_status.h" | 24 #include "content/public/common/ssl_status.h" |
25 | 25 |
26 using content::BrowserThread; | 26 using content::BrowserThread; |
27 using content::NavigationController; | 27 using content::NavigationController; |
28 using content::NavigationEntry; | 28 using content::NavigationEntry; |
29 using content::NavigationEntryImpl; | 29 using content::NavigationEntryImpl; |
30 using content::SSLStatus; | 30 using content::SSLStatus; |
31 using content::WebContents; | 31 using content::WebContents; |
32 | 32 |
33 // static | 33 // static |
34 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 34 void SSLManager::OnSSLCertificateError(SSLErrorHandler::Delegate* delegate, |
35 net::URLRequest* request, | 35 const content::GlobalRequestID& id, |
36 const net::SSLInfo& ssl_info, | 36 const net::SSLInfo& ssl_info, |
37 bool fatal) { | 37 bool fatal) { |
| 38 DCHECK(delegate); |
38 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 39 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
39 << net::MapCertStatusToNetError(ssl_info.cert_status) | 40 << net::MapCertStatusToNetError(ssl_info.cert_status) |
40 << " url: " << request->url().spec() | 41 << " id: " << id.child_id << "," << id.request_id |
| 42 << " url: " << delegate->URLForSSLRequest(id) |
41 << " cert_status: " << std::hex << ssl_info.cert_status; | 43 << " cert_status: " << std::hex << ssl_info.cert_status; |
42 | 44 |
43 ResourceDispatcherHostRequestInfo* info = | |
44 ResourceDispatcherHost::InfoForRequest(request); | |
45 | |
46 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 45 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
47 // hand it over to the UI thread for processing. | 46 // hand it over to the UI thread for processing. |
48 BrowserThread::PostTask( | 47 BrowserThread::PostTask( |
49 BrowserThread::UI, FROM_HERE, | 48 BrowserThread::UI, FROM_HERE, |
50 base::Bind(&SSLCertErrorHandler::Dispatch, | 49 base::Bind(&SSLCertErrorHandler::Dispatch, |
51 new SSLCertErrorHandler(rdh, | 50 new SSLCertErrorHandler(delegate, |
52 request, | 51 id, |
53 info->resource_type(), | |
54 ssl_info, | 52 ssl_info, |
55 fatal))); | 53 fatal))); |
56 } | 54 } |
57 | 55 |
58 // static | 56 // static |
59 void SSLManager::NotifySSLInternalStateChanged( | 57 void SSLManager::NotifySSLInternalStateChanged( |
60 NavigationControllerImpl* controller) { | 58 NavigationControllerImpl* controller) { |
61 content::NotificationService::current()->Notify( | 59 content::NotificationService::current()->Notify( |
62 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 60 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
63 content::Source<content::BrowserContext>(controller->GetBrowserContext()), | 61 content::Source<content::BrowserContext>(controller->GetBrowserContext()), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 211 |
214 policy()->UpdateEntry(entry, controller_->tab_contents()); | 212 policy()->UpdateEntry(entry, controller_->tab_contents()); |
215 | 213 |
216 if (!entry->GetSSL().Equals(original_ssl_status)) { | 214 if (!entry->GetSSL().Equals(original_ssl_status)) { |
217 content::NotificationService::current()->Notify( | 215 content::NotificationService::current()->Notify( |
218 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 216 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
219 content::Source<NavigationController>(controller_), | 217 content::Source<NavigationController>(controller_), |
220 content::NotificationService::NoDetails()); | 218 content::NotificationService::NoDetails()); |
221 } | 219 } |
222 } | 220 } |
OLD | NEW |