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" |
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_error_handler.h" | |
wtc
2012/02/24 00:44:38
Nit: this is already included by ssl_manager.h.
Takashi Toyoshima
2012/02/28 20:55:43
Done.
| |
14 #include "content/browser/ssl/ssl_policy.h" | 15 #include "content/browser/ssl/ssl_policy.h" |
15 #include "content/browser/ssl/ssl_request_info.h" | 16 #include "content/browser/ssl/ssl_request_info.h" |
16 #include "content/browser/tab_contents/navigation_entry_impl.h" | 17 #include "content/browser/tab_contents/navigation_entry_impl.h" |
17 #include "content/browser/tab_contents/provisional_load_details.h" | 18 #include "content/browser/tab_contents/provisional_load_details.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "content/common/ssl_status_serialization.h" | 20 #include "content/common/ssl_status_serialization.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
24 #include "content/public/common/ssl_status.h" | 25 #include "content/public/common/ssl_status.h" |
25 | 26 |
26 using content::BrowserThread; | 27 using content::BrowserThread; |
27 using content::NavigationController; | 28 using content::NavigationController; |
28 using content::NavigationEntry; | 29 using content::NavigationEntry; |
29 using content::NavigationEntryImpl; | 30 using content::NavigationEntryImpl; |
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(SSLErrorHandler::Delegate* delegate, |
35 net::URLRequest* request, | 36 const content::GlobalRequestID& id, |
36 const net::SSLInfo& ssl_info, | 37 const net::SSLInfo& ssl_info, |
37 bool fatal) { | 38 bool fatal) { |
39 DCHECK(delegate); | |
38 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 40 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
39 << net::MapCertStatusToNetError(ssl_info.cert_status) | 41 << net::MapCertStatusToNetError(ssl_info.cert_status) |
40 << " url: " << request->url().spec() | 42 << " instance_id: " << id.child_id << "," << id.request_id |
wtc
2012/02/24 00:44:38
Nit: update "instance_id" in this comment. Perhap
Takashi Toyoshima
2012/02/28 20:55:43
Done.
| |
43 << " url: " << delegate->URLForSSLRequest(id) | |
41 << " cert_status: " << std::hex << ssl_info.cert_status; | 44 << " cert_status: " << std::hex << ssl_info.cert_status; |
42 | 45 |
43 ResourceDispatcherHostRequestInfo* info = | |
44 ResourceDispatcherHost::InfoForRequest(request); | |
45 | |
46 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 46 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
47 // hand it over to the UI thread for processing. | 47 // hand it over to the UI thread for processing. |
48 BrowserThread::PostTask( | 48 BrowserThread::PostTask( |
49 BrowserThread::UI, FROM_HERE, | 49 BrowserThread::UI, FROM_HERE, |
50 base::Bind(&SSLCertErrorHandler::Dispatch, | 50 base::Bind(&SSLCertErrorHandler::Dispatch, |
51 new SSLCertErrorHandler(rdh, | 51 new SSLCertErrorHandler(delegate, |
52 request, | 52 id, |
53 info->resource_type(), | |
54 ssl_info, | 53 ssl_info, |
55 fatal))); | 54 fatal))); |
56 } | 55 } |
57 | 56 |
58 // static | 57 // static |
59 void SSLManager::NotifySSLInternalStateChanged( | 58 void SSLManager::NotifySSLInternalStateChanged( |
60 NavigationControllerImpl* controller) { | 59 NavigationControllerImpl* controller) { |
61 content::NotificationService::current()->Notify( | 60 content::NotificationService::current()->Notify( |
62 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 61 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
63 content::Source<content::BrowserContext>(controller->GetBrowserContext()), | 62 content::Source<content::BrowserContext>(controller->GetBrowserContext()), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 | 212 |
214 policy()->UpdateEntry(entry, controller_->tab_contents()); | 213 policy()->UpdateEntry(entry, controller_->tab_contents()); |
215 | 214 |
216 if (!entry->GetSSL().Equals(original_ssl_status)) { | 215 if (!entry->GetSSL().Equals(original_ssl_status)) { |
217 content::NotificationService::current()->Notify( | 216 content::NotificationService::current()->Notify( |
218 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 217 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
219 content::Source<NavigationController>(controller_), | 218 content::Source<NavigationController>(controller_), |
220 content::NotificationService::NoDetails()); | 219 content::NotificationService::NoDetails()); |
221 } | 220 } |
222 } | 221 } |
OLD | NEW |