| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 13 #include "content/browser/frame_host/navigation_entry_impl.h" | 13 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 14 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 14 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 15 #include "content/browser/loader/resource_request_info_impl.h" | 15 #include "content/browser/loader/resource_request_info_impl.h" |
| 16 #include "content/browser/ssl/ssl_error_handler.h" | 16 #include "content/browser/ssl/ssl_error_handler.h" |
| 17 #include "content/browser/ssl/ssl_policy.h" | 17 #include "content/browser/ssl/ssl_policy.h" |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/common/ssl_status_serialization.h" | 19 #include "content/common/ssl_status_serialization.h" |
| 20 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/load_from_memory_cache_details.h" | |
| 23 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
| 24 #include "content/public/browser/resource_request_details.h" | 23 #include "content/public/browser/resource_request_details.h" |
| 25 #include "content/public/common/ssl_status.h" | 24 #include "content/public/common/ssl_status.h" |
| 26 #include "net/url_request/url_request.h" | 25 #include "net/url_request/url_request.h" |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 | 28 |
| 30 namespace { | 29 namespace { |
| 31 | 30 |
| 32 const char kSSLManagerKeyName[] = "content_ssl_manager"; | 31 const char kSSLManagerKeyName[] = "content_ssl_manager"; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // load is committed, in case the active navigation entry has changed. | 159 // load is committed, in case the active navigation entry has changed. |
| 161 NotifyDidChangeVisibleSSLState(); | 160 NotifyDidChangeVisibleSSLState(); |
| 162 } | 161 } |
| 163 | 162 |
| 164 void SSLManager::DidRunInsecureContent(const GURL& security_origin) { | 163 void SSLManager::DidRunInsecureContent(const GURL& security_origin) { |
| 165 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); | 164 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); |
| 166 policy()->DidRunInsecureContent(navigation_entry, security_origin); | 165 policy()->DidRunInsecureContent(navigation_entry, security_origin); |
| 167 UpdateEntry(navigation_entry); | 166 UpdateEntry(navigation_entry); |
| 168 } | 167 } |
| 169 | 168 |
| 170 void SSLManager::DidLoadFromMemoryCache( | |
| 171 const LoadFromMemoryCacheDetails& details) { | |
| 172 // Simulate loading this resource through the usual path. | |
| 173 policy()->OnRequestStarted(details.url, details.cert_id, details.cert_status); | |
| 174 } | |
| 175 | |
| 176 void SSLManager::DidStartResourceResponse( | 169 void SSLManager::DidStartResourceResponse( |
| 177 const ResourceRequestDetails& details) { | 170 const ResourceRequestDetails& details) { |
| 178 // Notify our policy that we started a resource request. Ideally, the | 171 // Notify our policy that we started a resource request. Ideally, the |
| 179 // policy should have the ability to cancel the request, but we can't do | 172 // policy should have the ability to cancel the request, but we can't do |
| 180 // that yet. | 173 // that yet. |
| 181 policy()->OnRequestStarted(details.url, details.ssl_cert_id, | 174 policy()->OnRequestStarted(details.url, details.ssl_cert_id, |
| 182 details.ssl_cert_status); | 175 details.ssl_cert_status); |
| 183 } | 176 } |
| 184 | 177 |
| 185 void SSLManager::DidReceiveResourceRedirect( | 178 void SSLManager::DidReceiveResourceRedirect( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 205 NotifyDidChangeVisibleSSLState(); | 198 NotifyDidChangeVisibleSSLState(); |
| 206 } | 199 } |
| 207 | 200 |
| 208 void SSLManager::NotifyDidChangeVisibleSSLState() { | 201 void SSLManager::NotifyDidChangeVisibleSSLState() { |
| 209 WebContentsImpl* contents = | 202 WebContentsImpl* contents = |
| 210 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 203 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 211 contents->DidChangeVisibleSSLState(); | 204 contents->DidChangeVisibleSSLState(); |
| 212 } | 205 } |
| 213 | 206 |
| 214 } // namespace content | 207 } // namespace content |
| OLD | NEW |