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" | |
12 #include "content/browser/renderer_host/resource_request_details.h" | 11 #include "content/browser/renderer_host/resource_request_details.h" |
| 12 #include "content/browser/renderer_host/resource_request_info_impl.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_entry_impl.h" | 16 #include "content/browser/tab_contents/navigation_entry_impl.h" |
17 #include "content/browser/tab_contents/provisional_load_details.h" | 17 #include "content/browser/tab_contents/provisional_load_details.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "content/common/ssl_status_serialization.h" | 19 #include "content/common/ssl_status_serialization.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/navigation_details.h" | 21 #include "content/public/browser/navigation_details.h" |
22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
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::ResourceRequestInfoImpl; |
30 using content::SSLStatus; | 31 using content::SSLStatus; |
31 using content::WebContents; | 32 using content::WebContents; |
32 | 33 |
33 // static | 34 // static |
34 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 35 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, |
35 net::URLRequest* request, | 36 net::URLRequest* request, |
36 const net::SSLInfo& ssl_info, | 37 const net::SSLInfo& ssl_info, |
37 bool fatal) { | 38 bool fatal) { |
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 << " url: " << request->url().spec() |
41 << " cert_status: " << std::hex << ssl_info.cert_status; | 42 << " cert_status: " << std::hex << ssl_info.cert_status; |
42 | 43 |
43 ResourceDispatcherHostRequestInfo* info = | 44 ResourceRequestInfoImpl* info = |
44 ResourceDispatcherHost::InfoForRequest(request); | 45 ResourceDispatcherHost::InfoForRequest(request); |
45 | 46 |
46 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 47 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
47 // hand it over to the UI thread for processing. | 48 // hand it over to the UI thread for processing. |
48 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
49 BrowserThread::UI, FROM_HERE, | 50 BrowserThread::UI, FROM_HERE, |
50 base::Bind(&SSLCertErrorHandler::Dispatch, | 51 base::Bind(&SSLCertErrorHandler::Dispatch, |
51 new SSLCertErrorHandler(rdh, | 52 new SSLCertErrorHandler(rdh, |
52 request, | 53 request, |
53 info->resource_type(), | 54 info->GetResourceType(), |
54 ssl_info, | 55 ssl_info, |
55 fatal))); | 56 fatal))); |
56 } | 57 } |
57 | 58 |
58 // static | 59 // static |
59 void SSLManager::NotifySSLInternalStateChanged( | 60 void SSLManager::NotifySSLInternalStateChanged( |
60 NavigationControllerImpl* controller) { | 61 NavigationControllerImpl* controller) { |
61 content::NotificationService::current()->Notify( | 62 content::NotificationService::current()->Notify( |
62 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 63 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
63 content::Source<content::BrowserContext>(controller->GetBrowserContext()), | 64 content::Source<content::BrowserContext>(controller->GetBrowserContext()), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 214 |
214 policy()->UpdateEntry(entry, controller_->tab_contents()); | 215 policy()->UpdateEntry(entry, controller_->tab_contents()); |
215 | 216 |
216 if (!entry->GetSSL().Equals(original_ssl_status)) { | 217 if (!entry->GetSSL().Equals(original_ssl_status)) { |
217 content::NotificationService::current()->Notify( | 218 content::NotificationService::current()->Notify( |
218 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 219 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
219 content::Source<NavigationController>(controller_), | 220 content::Source<NavigationController>(controller_), |
220 content::NotificationService::NoDetails()); | 221 content::NotificationService::NoDetails()); |
221 } | 222 } |
222 } | 223 } |
OLD | NEW |