| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
| 10 #include "content/browser/load_from_memory_cache_details.h" | 10 #include "content/browser/load_from_memory_cache_details.h" |
| 11 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 11 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 13 #include "content/browser/renderer_host/resource_request_details.h" | 13 #include "content/browser/renderer_host/resource_request_details.h" |
| 14 #include "content/browser/ssl/ssl_cert_error_handler.h" | 14 #include "content/browser/ssl/ssl_cert_error_handler.h" |
| 15 #include "content/browser/ssl/ssl_policy.h" | 15 #include "content/browser/ssl/ssl_policy.h" |
| 16 #include "content/browser/ssl/ssl_request_info.h" | 16 #include "content/browser/ssl/ssl_request_info.h" |
| 17 #include "content/browser/tab_contents/navigation_details.h" | 17 #include "content/browser/tab_contents/navigation_details.h" |
| 18 #include "content/browser/tab_contents/navigation_entry.h" | 18 #include "content/browser/tab_contents/navigation_entry.h" |
| 19 #include "content/browser/tab_contents/provisional_load_details.h" | 19 #include "content/browser/tab_contents/provisional_load_details.h" |
| 20 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 21 #include "content/common/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 23 #include "net/base/cert_status_flags.h" | 23 #include "net/base/cert_status_flags.h" |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 26 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, |
| 27 net::URLRequest* request, | 27 net::URLRequest* request, |
| 28 const net::SSLInfo& ssl_info, | 28 const net::SSLInfo& ssl_info, |
| 29 bool is_hsts_host) { | 29 bool is_hsts_host) { |
| 30 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 30 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
| 31 << net::MapCertStatusToNetError(ssl_info.cert_status) | 31 << net::MapCertStatusToNetError(ssl_info.cert_status) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 new SSLCertErrorHandler(rdh, | 43 new SSLCertErrorHandler(rdh, |
| 44 request, | 44 request, |
| 45 info->resource_type(), | 45 info->resource_type(), |
| 46 ssl_info, | 46 ssl_info, |
| 47 is_hsts_host))); | 47 is_hsts_host))); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 void SSLManager::NotifySSLInternalStateChanged( | 51 void SSLManager::NotifySSLInternalStateChanged( |
| 52 NavigationController* controller) { | 52 NavigationController* controller) { |
| 53 NotificationService::current()->Notify( | 53 content::NotificationService::current()->Notify( |
| 54 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 54 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
| 55 content::Source<content::BrowserContext>(controller->browser_context()), | 55 content::Source<content::BrowserContext>(controller->browser_context()), |
| 56 NotificationService::NoDetails()); | 56 content::NotificationService::NoDetails()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 std::string SSLManager::SerializeSecurityInfo(int cert_id, | 60 std::string SSLManager::SerializeSecurityInfo(int cert_id, |
| 61 net::CertStatus cert_status, | 61 net::CertStatus cert_status, |
| 62 int security_bits, | 62 int security_bits, |
| 63 int ssl_connection_status) { | 63 int ssl_connection_status) { |
| 64 Pickle pickle; | 64 Pickle pickle; |
| 65 pickle.WriteInt(cert_id); | 65 pickle.WriteInt(cert_id); |
| 66 pickle.WriteUInt32(cert_status); | 66 pickle.WriteUInt32(cert_status); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // We don't always have a navigation entry to update, for example in the | 243 // We don't always have a navigation entry to update, for example in the |
| 244 // case of the Web Inspector. | 244 // case of the Web Inspector. |
| 245 if (!entry) | 245 if (!entry) |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 NavigationEntry::SSLStatus original_ssl_status = entry->ssl(); // Copy! | 248 NavigationEntry::SSLStatus original_ssl_status = entry->ssl(); // Copy! |
| 249 | 249 |
| 250 policy()->UpdateEntry(entry, controller_->tab_contents()); | 250 policy()->UpdateEntry(entry, controller_->tab_contents()); |
| 251 | 251 |
| 252 if (!entry->ssl().Equals(original_ssl_status)) { | 252 if (!entry->ssl().Equals(original_ssl_status)) { |
| 253 NotificationService::current()->Notify( | 253 content::NotificationService::current()->Notify( |
| 254 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 254 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
| 255 content::Source<NavigationController>(controller_), | 255 content::Source<NavigationController>(controller_), |
| 256 NotificationService::NoDetails()); | 256 content::NotificationService::NoDetails()); |
| 257 } | 257 } |
| 258 } | 258 } |
| OLD | NEW |