OLD | NEW |
1 // Copyright (c) 2012 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_impl.h" | 10 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
(...skipping 15 matching lines...) Expand all Loading... |
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::ResourceDispatcherHostImpl; | 30 using content::ResourceDispatcherHostImpl; |
31 using content::ResourceRequestInfoImpl; | 31 using content::ResourceRequestInfoImpl; |
32 using content::SSLStatus; | 32 using content::SSLStatus; |
33 using content::WebContents; | 33 using content::WebContents; |
34 | 34 |
35 // static | 35 // static |
36 void SSLManager::OnSSLCertificateError(net::URLRequest* request, | 36 void SSLManager::OnSSLCertificateError(SSLErrorHandler::Delegate* delegate, |
| 37 const content::GlobalRequestID& id, |
| 38 const ResourceType::Type resource_type, |
| 39 const GURL& url, |
| 40 int render_process_id, |
| 41 int render_view_id, |
37 const net::SSLInfo& ssl_info, | 42 const net::SSLInfo& ssl_info, |
38 bool fatal) { | 43 bool fatal) { |
| 44 DCHECK(delegate); |
39 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 45 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
40 << net::MapCertStatusToNetError(ssl_info.cert_status) | 46 << net::MapCertStatusToNetError(ssl_info.cert_status) |
41 << " url: " << request->url().spec() | 47 << " id: " << id.child_id << "," << id.request_id |
| 48 << " resource_type: " << resource_type |
| 49 << " url: " << url.spec() |
| 50 << " render_process_id: " << render_process_id |
| 51 << " render_view_id: " << render_view_id |
42 << " cert_status: " << std::hex << ssl_info.cert_status; | 52 << " cert_status: " << std::hex << ssl_info.cert_status; |
43 | 53 |
44 const ResourceRequestInfoImpl* info = | |
45 ResourceRequestInfoImpl::ForRequest(request); | |
46 | |
47 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 54 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
48 // hand it over to the UI thread for processing. | 55 // hand it over to the UI thread for processing. |
49 BrowserThread::PostTask( | 56 BrowserThread::PostTask( |
50 BrowserThread::UI, FROM_HERE, | 57 BrowserThread::UI, FROM_HERE, |
51 base::Bind(&SSLCertErrorHandler::Dispatch, | 58 base::Bind(&SSLCertErrorHandler::Dispatch, |
52 new SSLCertErrorHandler(ResourceDispatcherHostImpl::Get(), | 59 new SSLCertErrorHandler(delegate, |
53 request, | 60 id, |
54 info->GetResourceType(), | 61 resource_type, |
| 62 url, |
| 63 render_process_id, |
| 64 render_view_id, |
55 ssl_info, | 65 ssl_info, |
56 fatal))); | 66 fatal))); |
57 } | 67 } |
58 | 68 |
59 // static | 69 // static |
60 void SSLManager::NotifySSLInternalStateChanged( | 70 void SSLManager::NotifySSLInternalStateChanged( |
61 NavigationControllerImpl* controller) { | 71 NavigationControllerImpl* controller) { |
62 content::NotificationService::current()->Notify( | 72 content::NotificationService::current()->Notify( |
63 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 73 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
64 content::Source<content::BrowserContext>(controller->GetBrowserContext()), | 74 content::Source<content::BrowserContext>(controller->GetBrowserContext()), |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 219 |
210 policy()->UpdateEntry(entry, controller_->tab_contents()); | 220 policy()->UpdateEntry(entry, controller_->tab_contents()); |
211 | 221 |
212 if (!entry->GetSSL().Equals(original_ssl_status)) { | 222 if (!entry->GetSSL().Equals(original_ssl_status)) { |
213 content::NotificationService::current()->Notify( | 223 content::NotificationService::current()->Notify( |
214 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 224 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
215 content::Source<NavigationController>(controller_), | 225 content::Source<NavigationController>(controller_), |
216 content::NotificationService::NoDetails()); | 226 content::NotificationService::NoDetails()); |
217 } | 227 } |
218 } | 228 } |
OLD | NEW |