OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.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" |
12 #include "content/browser/renderer_host/resource_request_details.h" | 12 #include "content/browser/renderer_host/resource_request_details.h" |
13 #include "content/browser/ssl/ssl_cert_error_handler.h" | 13 #include "content/browser/ssl/ssl_cert_error_handler.h" |
14 #include "content/browser/ssl/ssl_policy.h" | 14 #include "content/browser/ssl/ssl_policy.h" |
15 #include "content/browser/ssl/ssl_request_info.h" | 15 #include "content/browser/ssl/ssl_request_info.h" |
16 #include "content/browser/tab_contents/navigation_details.h" | 16 #include "content/browser/tab_contents/navigation_details.h" |
17 #include "content/browser/tab_contents/navigation_entry.h" | 17 #include "content/browser/tab_contents/navigation_entry.h" |
18 #include "content/browser/tab_contents/provisional_load_details.h" | 18 #include "content/browser/tab_contents/provisional_load_details.h" |
19 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
20 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
21 #include "content/common/notification_source.h" | 21 #include "content/common/notification_source.h" |
22 #include "net/base/cert_status_flags.h" | 22 #include "net/base/cert_status_flags.h" |
23 | 23 |
24 // static | 24 // static |
25 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 25 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, |
26 net::URLRequest* request, | 26 net::URLRequest* request, |
27 int cert_error, | 27 const net::SSLInfo& ssl_info, |
28 net::X509Certificate* cert) { | 28 bool is_hsts_host) { |
29 DVLOG(1) << "OnSSLCertificateError() cert_error: " << cert_error | 29 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
30 << net::MapCertStatusToNetError(ssl_info.cert_status) | |
30 << " url: " << request->url().spec(); | 31 << " url: " << request->url().spec(); |
wtc
2011/09/26 19:15:10
Optional: I suggest we log cert_status instead of
| |
31 | 32 |
32 ResourceDispatcherHostRequestInfo* info = | 33 ResourceDispatcherHostRequestInfo* info = |
33 ResourceDispatcherHost::InfoForRequest(request); | 34 ResourceDispatcherHost::InfoForRequest(request); |
34 | 35 |
35 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 36 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
36 // hand it over to the UI thread for processing. | 37 // hand it over to the UI thread for processing. |
37 BrowserThread::PostTask( | 38 BrowserThread::PostTask( |
38 BrowserThread::UI, FROM_HERE, | 39 BrowserThread::UI, FROM_HERE, |
39 NewRunnableMethod(new SSLCertErrorHandler(rdh, | 40 NewRunnableMethod(new SSLCertErrorHandler(rdh, |
40 request, | 41 request, |
41 info->resource_type(), | 42 info->resource_type(), |
42 cert_error, | 43 ssl_info, |
43 cert), | 44 is_hsts_host), |
44 &SSLCertErrorHandler::Dispatch)); | 45 &SSLCertErrorHandler::Dispatch)); |
45 } | 46 } |
46 | 47 |
47 // static | 48 // static |
48 void SSLManager::NotifySSLInternalStateChanged( | 49 void SSLManager::NotifySSLInternalStateChanged( |
49 NavigationController* controller) { | 50 NavigationController* controller) { |
50 NotificationService::current()->Notify( | 51 NotificationService::current()->Notify( |
51 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 52 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
52 Source<content::BrowserContext>(controller->browser_context()), | 53 Source<content::BrowserContext>(controller->browser_context()), |
53 NotificationService::NoDetails()); | 54 NotificationService::NoDetails()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 | 241 |
241 policy()->UpdateEntry(entry, controller_->tab_contents()); | 242 policy()->UpdateEntry(entry, controller_->tab_contents()); |
242 | 243 |
243 if (!entry->ssl().Equals(original_ssl_status)) { | 244 if (!entry->ssl().Equals(original_ssl_status)) { |
244 NotificationService::current()->Notify( | 245 NotificationService::current()->Notify( |
245 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 246 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
246 Source<NavigationController>(controller_), | 247 Source<NavigationController>(controller_), |
247 NotificationService::NoDetails()); | 248 NotificationService::NoDetails()); |
248 } | 249 } |
249 } | 250 } |
OLD | NEW |