| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | |
| 10 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 11 #include "content/public/browser/resource_request_details.h" | |
| 12 #include "content/browser/renderer_host/resource_request_info_impl.h" | 10 #include "content/browser/renderer_host/resource_request_info_impl.h" |
| 13 #include "content/browser/ssl/ssl_cert_error_handler.h" | 11 #include "content/browser/ssl/ssl_cert_error_handler.h" |
| 14 #include "content/browser/ssl/ssl_policy.h" | 12 #include "content/browser/ssl/ssl_policy.h" |
| 15 #include "content/browser/ssl/ssl_request_info.h" | 13 #include "content/browser/ssl/ssl_request_info.h" |
| 16 #include "content/browser/web_contents/navigation_entry_impl.h" | 14 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 17 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
| 18 #include "content/common/ssl_status_serialization.h" | 16 #include "content/common/ssl_status_serialization.h" |
| 19 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/load_from_memory_cache_details.h" |
| 20 #include "content/public/browser/navigation_details.h" | 19 #include "content/public/browser/navigation_details.h" |
| 21 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
| 22 #include "content/public/browser/resource_request_details.h" |
| 23 #include "content/public/common/ssl_status.h" | 23 #include "content/public/common/ssl_status.h" |
| 24 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
| 25 | 25 |
| 26 using content::BrowserThread; | 26 using content::BrowserThread; |
| 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::ResourceDispatcherHostImpl; | 30 using content::ResourceDispatcherHostImpl; |
| 31 using content::ResourceRedirectDetails; | 31 using content::ResourceRedirectDetails; |
| 32 using content::ResourceRequestDetails; | 32 using content::ResourceRequestDetails; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 case content::NOTIFICATION_RESOURCE_RESPONSE_STARTED: | 151 case content::NOTIFICATION_RESOURCE_RESPONSE_STARTED: |
| 152 DidStartResourceResponse( | 152 DidStartResourceResponse( |
| 153 content::Details<ResourceRequestDetails>(details).ptr()); | 153 content::Details<ResourceRequestDetails>(details).ptr()); |
| 154 break; | 154 break; |
| 155 case content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: | 155 case content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: |
| 156 DidReceiveResourceRedirect( | 156 DidReceiveResourceRedirect( |
| 157 content::Details<ResourceRedirectDetails>(details).ptr()); | 157 content::Details<ResourceRedirectDetails>(details).ptr()); |
| 158 break; | 158 break; |
| 159 case content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE: | 159 case content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE: |
| 160 DidLoadFromMemoryCache( | 160 DidLoadFromMemoryCache( |
| 161 content::Details<LoadFromMemoryCacheDetails>(details).ptr()); | 161 content::Details<content::LoadFromMemoryCacheDetails>(details).ptr()); |
| 162 break; | 162 break; |
| 163 case content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED: | 163 case content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED: |
| 164 DidChangeSSLInternalState(); | 164 DidChangeSSLInternalState(); |
| 165 break; | 165 break; |
| 166 default: | 166 default: |
| 167 NOTREACHED() << "The SSLManager received an unexpected notification."; | 167 NOTREACHED() << "The SSLManager received an unexpected notification."; |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) { | 171 void SSLManager::DidLoadFromMemoryCache( |
| 172 content::LoadFromMemoryCacheDetails* details) { |
| 172 // Simulate loading this resource through the usual path. | 173 // Simulate loading this resource through the usual path. |
| 173 // Note that we specify SUB_RESOURCE as the resource type as WebCore only | 174 // Note that we specify SUB_RESOURCE as the resource type as WebCore only |
| 174 // caches sub-resources. | 175 // caches sub-resources. |
| 175 // This resource must have been loaded with no filtering because filtered | 176 // This resource must have been loaded with no filtering because filtered |
| 176 // resouces aren't cachable. | 177 // resouces aren't cachable. |
| 177 scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( | 178 scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( |
| 178 details->url(), | 179 details->url, |
| 179 ResourceType::SUB_RESOURCE, | 180 ResourceType::SUB_RESOURCE, |
| 180 details->pid(), | 181 details->pid, |
| 181 details->ssl_cert_id(), | 182 details->cert_id, |
| 182 details->ssl_cert_status())); | 183 details->cert_status)); |
| 183 | 184 |
| 184 // Simulate loading this resource through the usual path. | 185 // Simulate loading this resource through the usual path. |
| 185 policy()->OnRequestStarted(info.get()); | 186 policy()->OnRequestStarted(info.get()); |
| 186 } | 187 } |
| 187 | 188 |
| 188 void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) { | 189 void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) { |
| 189 scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( | 190 scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( |
| 190 details->url, | 191 details->url, |
| 191 details->resource_type, | 192 details->resource_type, |
| 192 details->origin_child_id, | 193 details->origin_child_id, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 222 | 223 |
| 223 policy()->UpdateEntry(entry, controller_->web_contents()); | 224 policy()->UpdateEntry(entry, controller_->web_contents()); |
| 224 | 225 |
| 225 if (!entry->GetSSL().Equals(original_ssl_status)) { | 226 if (!entry->GetSSL().Equals(original_ssl_status)) { |
| 226 content::NotificationService::current()->Notify( | 227 content::NotificationService::current()->Notify( |
| 227 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 228 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
| 228 content::Source<NavigationController>(controller_), | 229 content::Source<NavigationController>(controller_), |
| 229 content::NotificationService::NoDetails()); | 230 content::NotificationService::NoDetails()); |
| 230 } | 231 } |
| 231 } | 232 } |
| OLD | NEW |