| 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" |
| 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_policy.h" | 14 #include "content/browser/ssl/ssl_policy.h" |
| 15 #include "content/browser/ssl/ssl_request_info.h" | 15 #include "content/browser/ssl/ssl_request_info.h" |
| 16 #include "content/browser/tab_contents/navigation_entry.h" | 16 #include "content/browser/tab_contents/navigation_entry.h" |
| 17 #include "content/browser/tab_contents/provisional_load_details.h" | 17 #include "content/browser/tab_contents/provisional_load_details.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/public/browser/navigation_details.h" | 19 #include "content/public/browser/navigation_details.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/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 using content::BrowserThread; | 25 using content::BrowserThread; |
| 26 using content::WebContents; |
| 26 | 27 |
| 27 // static | 28 // static |
| 28 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 29 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, |
| 29 net::URLRequest* request, | 30 net::URLRequest* request, |
| 30 const net::SSLInfo& ssl_info, | 31 const net::SSLInfo& ssl_info, |
| 31 bool is_hsts_host) { | 32 bool is_hsts_host) { |
| 32 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 33 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
| 33 << net::MapCertStatusToNetError(ssl_info.cert_status) | 34 << net::MapCertStatusToNetError(ssl_info.cert_status) |
| 34 << " url: " << request->url().spec() | 35 << " url: " << request->url().spec() |
| 35 << " cert_status: " << std::hex << ssl_info.cert_status; | 36 << " cert_status: " << std::hex << ssl_info.cert_status; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 : backend_(controller), | 101 : backend_(controller), |
| 101 policy_(new SSLPolicy(&backend_)), | 102 policy_(new SSLPolicy(&backend_)), |
| 102 controller_(controller) { | 103 controller_(controller) { |
| 103 DCHECK(controller_); | 104 DCHECK(controller_); |
| 104 | 105 |
| 105 // Subscribe to various notifications. | 106 // Subscribe to various notifications. |
| 106 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 107 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
| 107 content::Source<NavigationController>(controller_)); | 108 content::Source<NavigationController>(controller_)); |
| 108 registrar_.Add( | 109 registrar_.Add( |
| 109 this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, | 110 this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, |
| 110 content::Source<RenderViewHostDelegate>(controller_->tab_contents())); | 111 content::Source<WebContents>(controller_->tab_contents())); |
| 111 registrar_.Add( | 112 registrar_.Add( |
| 112 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 113 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
| 113 content::Source<RenderViewHostDelegate>(controller_->tab_contents())); | 114 content::Source<WebContents>(controller_->tab_contents())); |
| 114 registrar_.Add( | 115 registrar_.Add( |
| 115 this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, | 116 this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, |
| 116 content::Source<NavigationController>(controller_)); | 117 content::Source<NavigationController>(controller_)); |
| 117 registrar_.Add( | 118 registrar_.Add( |
| 118 this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 119 this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
| 119 content::Source<content::BrowserContext>(controller_->browser_context())); | 120 content::Source<content::BrowserContext>(controller_->browser_context())); |
| 120 } | 121 } |
| 121 | 122 |
| 122 SSLManager::~SSLManager() { | 123 SSLManager::~SSLManager() { |
| 123 } | 124 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 252 |
| 252 policy()->UpdateEntry(entry, controller_->tab_contents()); | 253 policy()->UpdateEntry(entry, controller_->tab_contents()); |
| 253 | 254 |
| 254 if (!entry->ssl().Equals(original_ssl_status)) { | 255 if (!entry->ssl().Equals(original_ssl_status)) { |
| 255 content::NotificationService::current()->Notify( | 256 content::NotificationService::current()->Notify( |
| 256 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 257 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
| 257 content::Source<NavigationController>(controller_), | 258 content::Source<NavigationController>(controller_), |
| 258 content::NotificationService::NoDetails()); | 259 content::NotificationService::NoDetails()); |
| 259 } | 260 } |
| 260 } | 261 } |
| OLD | NEW |