| 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/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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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(ResourceDispatcherHost* rdh, |
| 35 net::URLRequest* request, | 35 net::URLRequest* request, |
| 36 const net::SSLInfo& ssl_info, | 36 const net::SSLInfo& ssl_info, |
| 37 bool is_hsts_host) { | 37 bool fatal) { |
| 38 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 38 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
| 39 << net::MapCertStatusToNetError(ssl_info.cert_status) | 39 << net::MapCertStatusToNetError(ssl_info.cert_status) |
| 40 << " url: " << request->url().spec() | 40 << " url: " << request->url().spec() |
| 41 << " cert_status: " << std::hex << ssl_info.cert_status; | 41 << " cert_status: " << std::hex << ssl_info.cert_status; |
| 42 | 42 |
| 43 ResourceDispatcherHostRequestInfo* info = | 43 ResourceDispatcherHostRequestInfo* info = |
| 44 ResourceDispatcherHost::InfoForRequest(request); | 44 ResourceDispatcherHost::InfoForRequest(request); |
| 45 | 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(rdh, |
| 52 request, | 52 request, |
| 53 info->resource_type(), | 53 info->resource_type(), |
| 54 ssl_info, | 54 ssl_info, |
| 55 is_hsts_host))); | 55 fatal))); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 void SSLManager::NotifySSLInternalStateChanged( | 59 void SSLManager::NotifySSLInternalStateChanged( |
| 60 NavigationControllerImpl* controller) { | 60 NavigationControllerImpl* controller) { |
| 61 content::NotificationService::current()->Notify( | 61 content::NotificationService::current()->Notify( |
| 62 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 62 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
| 63 content::Source<content::BrowserContext>(controller->GetBrowserContext()), | 63 content::Source<content::BrowserContext>(controller->GetBrowserContext()), |
| 64 content::NotificationService::NoDetails()); | 64 content::NotificationService::NoDetails()); |
| 65 } | 65 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 policy()->UpdateEntry(entry, controller_->tab_contents()); | 262 policy()->UpdateEntry(entry, controller_->tab_contents()); |
| 263 | 263 |
| 264 if (!entry->GetSSL().Equals(original_ssl_status)) { | 264 if (!entry->GetSSL().Equals(original_ssl_status)) { |
| 265 content::NotificationService::current()->Notify( | 265 content::NotificationService::current()->Notify( |
| 266 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 266 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
| 267 content::Source<NavigationController>(controller_), | 267 content::Source<NavigationController>(controller_), |
| 268 content::NotificationService::NoDetails()); | 268 content::NotificationService::NoDetails()); |
| 269 } | 269 } |
| 270 } | 270 } |
| OLD | NEW |