Chromium Code Reviews| 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_cert_error_handler.h" | 16 #include "content/browser/ssl/ssl_cert_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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 // load is committed, in case the active navigation entry has changed. | 132 // load is committed, in case the active navigation entry has changed. |
| 134 NotifyDidChangeVisibleSSLState(); | 133 NotifyDidChangeVisibleSSLState(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 void SSLManager::DidRunInsecureContent(const GURL& security_origin) { | 136 void SSLManager::DidRunInsecureContent(const GURL& security_origin) { |
| 138 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); | 137 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); |
| 139 policy()->DidRunInsecureContent(navigation_entry, security_origin); | 138 policy()->DidRunInsecureContent(navigation_entry, security_origin); |
| 140 UpdateEntry(navigation_entry); | 139 UpdateEntry(navigation_entry); |
| 141 } | 140 } |
| 142 | 141 |
| 143 void SSLManager::DidLoadFromMemoryCache( | |
| 144 const LoadFromMemoryCacheDetails& details) { | |
| 145 // Simulate loading this resource through the usual path. | |
|
jww
2016/08/09 02:42:18
nit: Probably should update the comment ssl_policy
felt
2016/08/10 14:17:17
Done.
| |
| 146 policy()->OnRequestStarted(details.url, details.cert_id, details.cert_status); | |
| 147 } | |
| 148 | |
| 149 void SSLManager::DidStartResourceResponse( | 142 void SSLManager::DidStartResourceResponse( |
| 150 const ResourceRequestDetails& details) { | 143 const ResourceRequestDetails& details) { |
| 151 // Notify our policy that we started a resource request. Ideally, the | 144 // Notify our policy that we started a resource request. Ideally, the |
| 152 // policy should have the ability to cancel the request, but we can't do | 145 // policy should have the ability to cancel the request, but we can't do |
| 153 // that yet. | 146 // that yet. |
| 154 policy()->OnRequestStarted(details.url, details.ssl_cert_id, | 147 policy()->OnRequestStarted(details.url, details.ssl_cert_id, |
| 155 details.ssl_cert_status); | 148 details.ssl_cert_status); |
| 156 } | 149 } |
| 157 | 150 |
| 158 void SSLManager::DidReceiveResourceRedirect( | 151 void SSLManager::DidReceiveResourceRedirect( |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 178 NotifyDidChangeVisibleSSLState(); | 171 NotifyDidChangeVisibleSSLState(); |
| 179 } | 172 } |
| 180 | 173 |
| 181 void SSLManager::NotifyDidChangeVisibleSSLState() { | 174 void SSLManager::NotifyDidChangeVisibleSSLState() { |
| 182 WebContentsImpl* contents = | 175 WebContentsImpl* contents = |
| 183 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 176 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 184 contents->DidChangeVisibleSSLState(); | 177 contents->DidChangeVisibleSSLState(); |
| 185 } | 178 } |
| 186 | 179 |
| 187 } // namespace content | 180 } // namespace content |
| OLD | NEW |