OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/ssl/ssl_manager.h" | 5 #include "chrome/browser/ssl/ssl_manager.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/message_loop.h" | 8 #include "chrome/browser/chrome_thread.h" |
9 #include "chrome/browser/load_from_memory_cache_details.h" | 9 #include "chrome/browser/load_from_memory_cache_details.h" |
10 #include "chrome/browser/net/url_request_tracking.h" | 10 #include "chrome/browser/net/url_request_tracking.h" |
11 #include "chrome/browser/renderer_host/resource_request_details.h" | 11 #include "chrome/browser/renderer_host/resource_request_details.h" |
12 #include "chrome/browser/ssl/ssl_cert_error_handler.h" | 12 #include "chrome/browser/ssl/ssl_cert_error_handler.h" |
13 #include "chrome/browser/ssl/ssl_policy.h" | 13 #include "chrome/browser/ssl/ssl_policy.h" |
14 #include "chrome/browser/ssl/ssl_request_info.h" | 14 #include "chrome/browser/ssl/ssl_request_info.h" |
15 #include "chrome/browser/tab_contents/navigation_controller.h" | 15 #include "chrome/browser/tab_contents/navigation_controller.h" |
16 #include "chrome/browser/tab_contents/navigation_entry.h" | 16 #include "chrome/browser/tab_contents/navigation_entry.h" |
17 #include "chrome/browser/tab_contents/provisional_load_details.h" | 17 #include "chrome/browser/tab_contents/provisional_load_details.h" |
18 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return false; | 56 return false; |
57 } | 57 } |
58 | 58 |
59 return net::IsCertStatusError(entry->ssl().cert_status()); | 59 return net::IsCertStatusError(entry->ssl().cert_status()); |
60 } | 60 } |
61 | 61 |
62 // static | 62 // static |
63 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 63 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, |
64 URLRequest* request, | 64 URLRequest* request, |
65 int cert_error, | 65 int cert_error, |
66 net::X509Certificate* cert, | 66 net::X509Certificate* cert) { |
67 MessageLoop* ui_loop) { | |
68 DLOG(INFO) << "OnSSLCertificateError() cert_error: " << cert_error << | 67 DLOG(INFO) << "OnSSLCertificateError() cert_error: " << cert_error << |
69 " url: " << request->url().spec(); | 68 " url: " << request->url().spec(); |
70 | 69 |
71 ResourceDispatcherHostRequestInfo* info = | 70 ResourceDispatcherHostRequestInfo* info = |
72 ResourceDispatcherHost::InfoForRequest(request); | 71 ResourceDispatcherHost::InfoForRequest(request); |
73 DCHECK(info); | 72 DCHECK(info); |
74 | 73 |
75 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 74 // A certificate error occurred. Construct a SSLCertErrorHandler object and |
76 // hand it over to the UI thread for processing. | 75 // hand it over to the UI thread for processing. |
77 ui_loop->PostTask(FROM_HERE, | 76 ChromeThread::PostTask( |
| 77 ChromeThread::UI, FROM_HERE, |
78 NewRunnableMethod(new SSLCertErrorHandler(rdh, | 78 NewRunnableMethod(new SSLCertErrorHandler(rdh, |
79 request, | 79 request, |
80 info->resource_type(), | 80 info->resource_type(), |
81 info->frame_origin(), | 81 info->frame_origin(), |
82 info->main_frame_origin(), | 82 info->main_frame_origin(), |
83 cert_error, | 83 cert_error, |
84 cert, | 84 cert), |
85 ui_loop), | |
86 &SSLCertErrorHandler::Dispatch)); | 85 &SSLCertErrorHandler::Dispatch)); |
87 } | 86 } |
88 | 87 |
89 void SSLManager::DidDisplayInsecureContent() { | 88 void SSLManager::DidDisplayInsecureContent() { |
90 policy()->DidDisplayInsecureContent(controller_->GetActiveEntry()); | 89 policy()->DidDisplayInsecureContent(controller_->GetActiveEntry()); |
91 } | 90 } |
92 | 91 |
93 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { | 92 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { |
94 policy()->DidRunInsecureContent(controller_->GetActiveEntry(), | 93 policy()->DidRunInsecureContent(controller_->GetActiveEntry(), |
95 security_origin); | 94 security_origin); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 295 } |
297 | 296 |
298 if (ca_name) { | 297 if (ca_name) { |
299 // TODO(wtc): should we show the root CA's name instead? | 298 // TODO(wtc): should we show the root CA's name instead? |
300 *ca_name = l10n_util::GetStringF( | 299 *ca_name = l10n_util::GetStringF( |
301 IDS_SECURE_CONNECTION_EV_CA, | 300 IDS_SECURE_CONNECTION_EV_CA, |
302 UTF8ToWide(cert.issuer().organization_names[0])); | 301 UTF8ToWide(cert.issuer().organization_names[0])); |
303 } | 302 } |
304 return true; | 303 return true; |
305 } | 304 } |
OLD | NEW |