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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1950 | 1950 |
1951 scoped_ptr<storage::QuotaEvictionPolicy> | 1951 scoped_ptr<storage::QuotaEvictionPolicy> |
1952 ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( | 1952 ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( |
1953 content::BrowserContext* context) { | 1953 content::BrowserContext* context) { |
1954 return SiteEngagementEvictionPolicy::IsEnabled() | 1954 return SiteEngagementEvictionPolicy::IsEnabled() |
1955 ? make_scoped_ptr(new SiteEngagementEvictionPolicy(context)) | 1955 ? make_scoped_ptr(new SiteEngagementEvictionPolicy(context)) |
1956 : nullptr; | 1956 : nullptr; |
1957 } | 1957 } |
1958 | 1958 |
1959 void ChromeContentBrowserClient::AllowCertificateError( | 1959 void ChromeContentBrowserClient::AllowCertificateError( |
1960 int render_process_id, | 1960 const content::ResourceRequestInfo::WebContentsGetterOnUI& |
1961 int render_frame_id, | 1961 web_contents_getter, |
davidben
2015/11/19 17:46:13
Rather than passing in this callback, it's probabl
clamy
2015/11/20 13:50:42
Since it's impossible not to have a WebContents he
| |
1962 int cert_error, | 1962 int cert_error, |
1963 const net::SSLInfo& ssl_info, | 1963 const net::SSLInfo& ssl_info, |
1964 const GURL& request_url, | 1964 const GURL& request_url, |
1965 ResourceType resource_type, | 1965 ResourceType resource_type, |
1966 bool overridable, | 1966 bool overridable, |
1967 bool strict_enforcement, | 1967 bool strict_enforcement, |
1968 bool expired_previous_decision, | 1968 bool expired_previous_decision, |
1969 const base::Callback<void(bool)>& callback, | 1969 const base::Callback<void(bool)>& callback, |
1970 content::CertificateRequestResultType* result) { | 1970 content::CertificateRequestResultType* result) { |
1971 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { | 1971 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { |
1972 // A sub-resource has a certificate error. The user doesn't really | 1972 // A sub-resource has a certificate error. The user doesn't really |
1973 // have a context for making the right decision, so block the | 1973 // have a context for making the right decision, so block the |
1974 // request hard, without an info bar to allow showing the insecure | 1974 // request hard, without an info bar to allow showing the insecure |
1975 // content. | 1975 // content. |
1976 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; | 1976 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; |
1977 return; | 1977 return; |
1978 } | 1978 } |
1979 | 1979 |
1980 // If the tab is being prerendered, cancel the prerender and the request. | 1980 // If the tab is being prerendered, cancel the prerender and the request. |
1981 content::RenderFrameHost* render_frame_host = | 1981 WebContents* tab = web_contents_getter.Run(); |
1982 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | |
1983 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host); | |
1984 if (!tab) { | 1982 if (!tab) { |
1985 NOTREACHED(); | 1983 NOTREACHED(); |
1986 return; | 1984 return; |
1987 } | 1985 } |
1988 | 1986 |
1989 prerender::PrerenderContents* prerender_contents = | 1987 prerender::PrerenderContents* prerender_contents = |
1990 prerender::PrerenderContents::FromWebContents(tab); | 1988 prerender::PrerenderContents::FromWebContents(tab); |
1991 if (prerender_contents) { | 1989 if (prerender_contents) { |
1992 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); | 1990 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); |
1993 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; | 1991 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2780 if (channel <= kMaxDisableEncryptionChannel) { | 2778 if (channel <= kMaxDisableEncryptionChannel) { |
2781 static const char* const kWebRtcDevSwitchNames[] = { | 2779 static const char* const kWebRtcDevSwitchNames[] = { |
2782 switches::kDisableWebRtcEncryption, | 2780 switches::kDisableWebRtcEncryption, |
2783 }; | 2781 }; |
2784 to_command_line->CopySwitchesFrom(from_command_line, | 2782 to_command_line->CopySwitchesFrom(from_command_line, |
2785 kWebRtcDevSwitchNames, | 2783 kWebRtcDevSwitchNames, |
2786 arraysize(kWebRtcDevSwitchNames)); | 2784 arraysize(kWebRtcDevSwitchNames)); |
2787 } | 2785 } |
2788 } | 2786 } |
2789 #endif // defined(ENABLE_WEBRTC) | 2787 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |