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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 | 1956 |
1957 scoped_ptr<storage::QuotaEvictionPolicy> | 1957 scoped_ptr<storage::QuotaEvictionPolicy> |
1958 ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( | 1958 ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( |
1959 content::BrowserContext* context) { | 1959 content::BrowserContext* context) { |
1960 return SiteEngagementEvictionPolicy::IsEnabled() | 1960 return SiteEngagementEvictionPolicy::IsEnabled() |
1961 ? make_scoped_ptr(new SiteEngagementEvictionPolicy(context)) | 1961 ? make_scoped_ptr(new SiteEngagementEvictionPolicy(context)) |
1962 : nullptr; | 1962 : nullptr; |
1963 } | 1963 } |
1964 | 1964 |
1965 void ChromeContentBrowserClient::AllowCertificateError( | 1965 void ChromeContentBrowserClient::AllowCertificateError( |
1966 int render_process_id, | 1966 content::WebContents* web_contents, |
1967 int render_frame_id, | |
1968 int cert_error, | 1967 int cert_error, |
1969 const net::SSLInfo& ssl_info, | 1968 const net::SSLInfo& ssl_info, |
1970 const GURL& request_url, | 1969 const GURL& request_url, |
1971 ResourceType resource_type, | 1970 ResourceType resource_type, |
1972 bool overridable, | 1971 bool overridable, |
1973 bool strict_enforcement, | 1972 bool strict_enforcement, |
1974 bool expired_previous_decision, | 1973 bool expired_previous_decision, |
1975 const base::Callback<void(bool)>& callback, | 1974 const base::Callback<void(bool)>& callback, |
1976 content::CertificateRequestResultType* result) { | 1975 content::CertificateRequestResultType* result) { |
| 1976 DCHECK(web_contents); |
1977 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { | 1977 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { |
1978 // A sub-resource has a certificate error. The user doesn't really | 1978 // A sub-resource has a certificate error. The user doesn't really |
1979 // have a context for making the right decision, so block the | 1979 // have a context for making the right decision, so block the |
1980 // request hard, without an info bar to allow showing the insecure | 1980 // request hard, without an info bar to allow showing the insecure |
1981 // content. | 1981 // content. |
1982 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; | 1982 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; |
1983 return; | 1983 return; |
1984 } | 1984 } |
1985 | 1985 |
1986 // If the tab is being prerendered, cancel the prerender and the request. | 1986 // If the tab is being prerendered, cancel the prerender and the request. |
1987 content::RenderFrameHost* render_frame_host = | |
1988 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | |
1989 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host); | |
1990 if (!tab) { | |
1991 NOTREACHED(); | |
1992 return; | |
1993 } | |
1994 | |
1995 prerender::PrerenderContents* prerender_contents = | 1987 prerender::PrerenderContents* prerender_contents = |
1996 prerender::PrerenderContents::FromWebContents(tab); | 1988 prerender::PrerenderContents::FromWebContents(web_contents); |
1997 if (prerender_contents) { | 1989 if (prerender_contents) { |
1998 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); | 1990 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); |
1999 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; | 1991 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; |
2000 return; | 1992 return; |
2001 } | 1993 } |
2002 | 1994 |
2003 // Otherwise, display an SSL blocking page. The interstitial page takes | 1995 // Otherwise, display an SSL blocking page. The interstitial page takes |
2004 // ownership of ssl_blocking_page. | 1996 // ownership of ssl_blocking_page. |
2005 int options_mask = 0; | 1997 int options_mask = 0; |
2006 if (overridable) | 1998 if (overridable) |
2007 options_mask |= SSLBlockingPage::OVERRIDABLE; | 1999 options_mask |= SSLBlockingPage::OVERRIDABLE; |
2008 if (strict_enforcement) | 2000 if (strict_enforcement) |
2009 options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT; | 2001 options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT; |
2010 if (expired_previous_decision) | 2002 if (expired_previous_decision) |
2011 options_mask |= SSLBlockingPage::EXPIRED_BUT_PREVIOUSLY_ALLOWED; | 2003 options_mask |= SSLBlockingPage::EXPIRED_BUT_PREVIOUSLY_ALLOWED; |
2012 | 2004 |
2013 safe_browsing::SafeBrowsingService* safe_browsing_service = | 2005 safe_browsing::SafeBrowsingService* safe_browsing_service = |
2014 g_browser_process->safe_browsing_service(); | 2006 g_browser_process->safe_browsing_service(); |
2015 scoped_ptr<SafeBrowsingSSLCertReporter> cert_reporter( | 2007 scoped_ptr<SafeBrowsingSSLCertReporter> cert_reporter( |
2016 new SafeBrowsingSSLCertReporter(safe_browsing_service | 2008 new SafeBrowsingSSLCertReporter(safe_browsing_service |
2017 ? safe_browsing_service->ui_manager() | 2009 ? safe_browsing_service->ui_manager() |
2018 : nullptr)); | 2010 : nullptr)); |
2019 SSLErrorHandler::HandleSSLError(tab, cert_error, ssl_info, request_url, | 2011 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, |
2020 options_mask, cert_reporter.Pass(), callback); | 2012 request_url, options_mask, |
| 2013 cert_reporter.Pass(), callback); |
2021 } | 2014 } |
2022 | 2015 |
2023 void ChromeContentBrowserClient::SelectClientCertificate( | 2016 void ChromeContentBrowserClient::SelectClientCertificate( |
2024 content::WebContents* web_contents, | 2017 content::WebContents* web_contents, |
2025 net::SSLCertRequestInfo* cert_request_info, | 2018 net::SSLCertRequestInfo* cert_request_info, |
2026 scoped_ptr<content::ClientCertificateDelegate> delegate) { | 2019 scoped_ptr<content::ClientCertificateDelegate> delegate) { |
2027 prerender::PrerenderContents* prerender_contents = | 2020 prerender::PrerenderContents* prerender_contents = |
2028 prerender::PrerenderContents::FromWebContents(web_contents); | 2021 prerender::PrerenderContents::FromWebContents(web_contents); |
2029 if (prerender_contents) { | 2022 if (prerender_contents) { |
2030 prerender_contents->Destroy( | 2023 prerender_contents->Destroy( |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 if (channel <= kMaxDisableEncryptionChannel) { | 2779 if (channel <= kMaxDisableEncryptionChannel) { |
2787 static const char* const kWebRtcDevSwitchNames[] = { | 2780 static const char* const kWebRtcDevSwitchNames[] = { |
2788 switches::kDisableWebRtcEncryption, | 2781 switches::kDisableWebRtcEncryption, |
2789 }; | 2782 }; |
2790 to_command_line->CopySwitchesFrom(from_command_line, | 2783 to_command_line->CopySwitchesFrom(from_command_line, |
2791 kWebRtcDevSwitchNames, | 2784 kWebRtcDevSwitchNames, |
2792 arraysize(kWebRtcDevSwitchNames)); | 2785 arraysize(kWebRtcDevSwitchNames)); |
2793 } | 2786 } |
2794 } | 2787 } |
2795 #endif // defined(ENABLE_WEBRTC) | 2788 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |