| 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_impl.h" | 16 #include "content/browser/tab_contents/navigation_entry_impl.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/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/navigation_details.h" | 20 #include "content/public/browser/navigation_details.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 "content/public/browser/ssl_status.h" | 23 #include "content/public/browser/ssl_status.h" |
| 24 #include "net/base/cert_status_flags.h" | 24 #include "net/base/cert_status_flags.h" |
| 25 | 25 |
| 26 using content::BrowserThread; | 26 using content::BrowserThread; |
| 27 using content::NavigationController; |
| 27 using content::NavigationEntry; | 28 using content::NavigationEntry; |
| 28 using content::NavigationEntryImpl; | 29 using content::NavigationEntryImpl; |
| 29 using content::SSLStatus; | 30 using content::SSLStatus; |
| 30 using content::WebContents; | 31 using content::WebContents; |
| 31 | 32 |
| 32 // static | 33 // static |
| 33 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, | 34 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, |
| 34 net::URLRequest* request, | 35 net::URLRequest* request, |
| 35 const net::SSLInfo& ssl_info, | 36 const net::SSLInfo& ssl_info, |
| 36 bool is_hsts_host) { | 37 bool is_hsts_host) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 103 } |
| 103 | 104 |
| 104 SSLManager::SSLManager(NavigationControllerImpl* controller) | 105 SSLManager::SSLManager(NavigationControllerImpl* controller) |
| 105 : backend_(controller), | 106 : backend_(controller), |
| 106 policy_(new SSLPolicy(&backend_)), | 107 policy_(new SSLPolicy(&backend_)), |
| 107 controller_(controller) { | 108 controller_(controller) { |
| 108 DCHECK(controller_); | 109 DCHECK(controller_); |
| 109 | 110 |
| 110 // Subscribe to various notifications. | 111 // Subscribe to various notifications. |
| 111 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 112 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
| 112 content::Source<content::NavigationController>(controller_)); | 113 content::Source<:NavigationController>(controller_)); |
| 113 registrar_.Add( | 114 registrar_.Add( |
| 114 this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, | 115 this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, |
| 115 content::Source<WebContents>(controller_->tab_contents())); | 116 content::Source<WebContents>(controller_->tab_contents())); |
| 116 registrar_.Add( | 117 registrar_.Add( |
| 117 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 118 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
| 118 content::Source<WebContents>(controller_->tab_contents())); | 119 content::Source<WebContents>(controller_->tab_contents())); |
| 119 registrar_.Add( | 120 registrar_.Add( |
| 120 this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, | 121 this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, |
| 121 content::Source<content::NavigationController>(controller_)); | 122 content::Source<NavigationController>(controller_)); |
| 122 registrar_.Add( | 123 registrar_.Add( |
| 123 this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, | 124 this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, |
| 124 content::Source<content::BrowserContext>( | 125 content::Source<content::BrowserContext>( |
| 125 controller_->GetBrowserContext())); | 126 controller_->GetBrowserContext())); |
| 126 } | 127 } |
| 127 | 128 |
| 128 SSLManager::~SSLManager() { | 129 SSLManager::~SSLManager() { |
| 129 } | 130 } |
| 130 | 131 |
| 131 void SSLManager::DidCommitProvisionalLoad( | 132 void SSLManager::DidCommitProvisionalLoad( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (!entry) | 257 if (!entry) |
| 257 return; | 258 return; |
| 258 | 259 |
| 259 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! | 260 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! |
| 260 | 261 |
| 261 policy()->UpdateEntry(entry, controller_->tab_contents()); | 262 policy()->UpdateEntry(entry, controller_->tab_contents()); |
| 262 | 263 |
| 263 if (!entry->GetSSL().Equals(original_ssl_status)) { | 264 if (!entry->GetSSL().Equals(original_ssl_status)) { |
| 264 content::NotificationService::current()->Notify( | 265 content::NotificationService::current()->Notify( |
| 265 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 266 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
| 266 content::Source<content::NavigationController>(controller_), | 267 content::Source<NavigationController>(controller_), |
| 267 content::NotificationService::NoDetails()); | 268 content::NotificationService::NoDetails()); |
| 268 } | 269 } |
| 269 } | 270 } |
| OLD | NEW |