| 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_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" | 22 #include "content/public/browser/load_from_memory_cache_details.h" |
| 23 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
| 24 #include "content/public/browser/resource_request_details.h" | 24 #include "content/public/browser/resource_request_details.h" |
| 25 #include "content/public/common/ssl_status.h" | 25 #include "content/public/common/ssl_status.h" |
| 26 #include "net/url_request/url_request.h" | 26 #include "net/url_request/url_request.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 54 const base::Callback<WebContents*(void)>& web_contents_getter, | 54 const base::Callback<WebContents*(void)>& web_contents_getter, |
| 55 const net::SSLInfo& ssl_info, | 55 const net::SSLInfo& ssl_info, |
| 56 bool fatal) { | 56 bool fatal) { |
| 57 DCHECK(delegate.get()); | 57 DCHECK(delegate.get()); |
| 58 DVLOG(1) << "OnSSLCertificateError() cert_error: " | 58 DVLOG(1) << "OnSSLCertificateError() cert_error: " |
| 59 << net::MapCertStatusToNetError(ssl_info.cert_status) | 59 << net::MapCertStatusToNetError(ssl_info.cert_status) |
| 60 << " resource_type: " << resource_type | 60 << " resource_type: " << resource_type |
| 61 << " url: " << url.spec() | 61 << " url: " << url.spec() |
| 62 << " cert_status: " << std::hex << ssl_info.cert_status; | 62 << " cert_status: " << std::hex << ssl_info.cert_status; |
| 63 | 63 |
| 64 // A certificate error occurred. Construct a SSLCertErrorHandler object and | 64 // A certificate error occurred. Construct a SSLErrorHandler object and |
| 65 // hand it over to the UI thread for processing. | 65 // hand it over to the UI thread for processing. |
| 66 BrowserThread::PostTask( | 66 BrowserThread::PostTask( |
| 67 BrowserThread::UI, FROM_HERE, | 67 BrowserThread::UI, FROM_HERE, |
| 68 base::Bind(&SSLCertErrorHandler::Dispatch, | 68 base::Bind( |
| 69 new SSLCertErrorHandler(delegate, resource_type, url, ssl_info, | 69 &SSLErrorHandler::Dispatch, |
| 70 fatal), | 70 new SSLErrorHandler(delegate, resource_type, url, ssl_info, fatal), |
| 71 web_contents_getter)); | 71 web_contents_getter)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 void SSLManager::OnSSLCertificateSubresourceError( | 75 void SSLManager::OnSSLCertificateSubresourceError( |
| 76 const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, | 76 const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, |
| 77 const GURL& url, | 77 const GURL& url, |
| 78 int render_process_id, | 78 int render_process_id, |
| 79 int render_frame_id, | 79 int render_frame_id, |
| 80 const net::SSLInfo& ssl_info, | 80 const net::SSLInfo& ssl_info, |
| 81 bool fatal) { | 81 bool fatal) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 NotifyDidChangeVisibleSSLState(); | 178 NotifyDidChangeVisibleSSLState(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void SSLManager::NotifyDidChangeVisibleSSLState() { | 181 void SSLManager::NotifyDidChangeVisibleSSLState() { |
| 182 WebContentsImpl* contents = | 182 WebContentsImpl* contents = |
| 183 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 183 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 184 contents->DidChangeVisibleSSLState(); | 184 contents->DidChangeVisibleSSLState(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace content | 187 } // namespace content |
| OLD | NEW |