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 ResourceType::Type resource_type, |
| 37 const GURL& url, |
| 38 int render_process_id, |
| 39 int render_view_id, |
36 const net::SSLInfo& ssl_info, | 40 const net::SSLInfo& ssl_info, |
37 bool fatal) { | 41 bool fatal) { |
| 42 DCHECK(delegate); |
38 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 43 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
39 << net::MapCertStatusToNetError(ssl_info.cert_status) | 44 << net::MapCertStatusToNetError(ssl_info.cert_status) |
40 << " url: " << request->url().spec() | 45 << " id: " << id.child_id << "," << id.request_id |
| 46 << " resource_type: " << resource_type |
| 47 << " url: " << url |
| 48 << " render_process_id: " << render_process_id |
| 49 << " render_view_id: " << render_view_id |
41 << " cert_status: " << std::hex << ssl_info.cert_status; | 50 << " cert_status: " << std::hex << ssl_info.cert_status; |
42 | 51 |
43 ResourceDispatcherHostRequestInfo* info = | |
44 ResourceDispatcherHost::InfoForRequest(request); | |
45 | |
46 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 52 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
47 // hand it over to the UI thread for processing. | 53 // hand it over to the UI thread for processing. |
48 BrowserThread::PostTask( | 54 BrowserThread::PostTask( |
49 BrowserThread::UI, FROM_HERE, | 55 BrowserThread::UI, FROM_HERE, |
50 base::Bind(&SSLCertErrorHandler::Dispatch, | 56 base::Bind(&SSLCertErrorHandler::Dispatch, |
51 new SSLCertErrorHandler(rdh, | 57 new SSLCertErrorHandler(delegate, |
52 request, | 58 id, |
53 info->resource_type(), | 59 resource_type, |
| 60 url, |
| 61 render_process_id, |
| 62 render_view_id, |
54 ssl_info, | 63 ssl_info, |
55 fatal))); | 64 fatal))); |
56 } | 65 } |
57 | 66 |
58 // static | 67 // static |
59 void SSLManager::NotifySSLInternalStateChanged( | 68 void SSLManager::NotifySSLInternalStateChanged( |
60 NavigationControllerImpl* controller) { | 69 NavigationControllerImpl* controller) { |
61 content::NotificationService::current()->Notify( | 70 content::NotificationService::current()->Notify( |
62 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 71 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
63 content::Source<content::BrowserContext>(controller->GetBrowserContext()), | 72 content::Source<content::BrowserContext>(controller->GetBrowserContext()), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 222 |
214 policy()->UpdateEntry(entry, controller_->tab_contents()); | 223 policy()->UpdateEntry(entry, controller_->tab_contents()); |
215 | 224 |
216 if (!entry->GetSSL().Equals(original_ssl_status)) { | 225 if (!entry->GetSSL().Equals(original_ssl_status)) { |
217 content::NotificationService::current()->Notify( | 226 content::NotificationService::current()->Notify( |
218 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 227 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
219 content::Source<NavigationController>(controller_), | 228 content::Source<NavigationController>(controller_), |
220 content::NotificationService::NoDetails()); | 229 content::NotificationService::NoDetails()); |
221 } | 230 } |
222 } | 231 } |
OLD | NEW |