Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1459473003: Add a WebContents getter callback in ResourceRequestInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed davidben's comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 content::WebContents* web_contents,
1961 int render_frame_id,
1962 int cert_error, 1961 int cert_error,
1963 const net::SSLInfo& ssl_info, 1962 const net::SSLInfo& ssl_info,
1964 const GURL& request_url, 1963 const GURL& request_url,
1965 ResourceType resource_type, 1964 ResourceType resource_type,
1966 bool overridable, 1965 bool overridable,
1967 bool strict_enforcement, 1966 bool strict_enforcement,
1968 bool expired_previous_decision, 1967 bool expired_previous_decision,
1969 const base::Callback<void(bool)>& callback, 1968 const base::Callback<void(bool)>& callback,
1970 content::CertificateRequestResultType* result) { 1969 content::CertificateRequestResultType* result) {
1970 DCHECK(web_contents);
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 =
1982 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
1983 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host);
1984 if (!tab) {
1985 NOTREACHED();
1986 return;
1987 }
1988
1989 prerender::PrerenderContents* prerender_contents = 1981 prerender::PrerenderContents* prerender_contents =
1990 prerender::PrerenderContents::FromWebContents(tab); 1982 prerender::PrerenderContents::FromWebContents(web_contents);
1991 if (prerender_contents) { 1983 if (prerender_contents) {
1992 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); 1984 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR);
1993 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; 1985 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL;
1994 return; 1986 return;
1995 } 1987 }
1996 1988
1997 // Otherwise, display an SSL blocking page. The interstitial page takes 1989 // Otherwise, display an SSL blocking page. The interstitial page takes
1998 // ownership of ssl_blocking_page. 1990 // ownership of ssl_blocking_page.
1999 int options_mask = 0; 1991 int options_mask = 0;
2000 if (overridable) 1992 if (overridable)
2001 options_mask |= SSLBlockingPage::OVERRIDABLE; 1993 options_mask |= SSLBlockingPage::OVERRIDABLE;
2002 if (strict_enforcement) 1994 if (strict_enforcement)
2003 options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT; 1995 options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT;
2004 if (expired_previous_decision) 1996 if (expired_previous_decision)
2005 options_mask |= SSLBlockingPage::EXPIRED_BUT_PREVIOUSLY_ALLOWED; 1997 options_mask |= SSLBlockingPage::EXPIRED_BUT_PREVIOUSLY_ALLOWED;
2006 1998
2007 safe_browsing::SafeBrowsingService* safe_browsing_service = 1999 safe_browsing::SafeBrowsingService* safe_browsing_service =
2008 g_browser_process->safe_browsing_service(); 2000 g_browser_process->safe_browsing_service();
2009 scoped_ptr<SafeBrowsingSSLCertReporter> cert_reporter( 2001 scoped_ptr<SafeBrowsingSSLCertReporter> cert_reporter(
2010 new SafeBrowsingSSLCertReporter(safe_browsing_service 2002 new SafeBrowsingSSLCertReporter(safe_browsing_service
2011 ? safe_browsing_service->ui_manager() 2003 ? safe_browsing_service->ui_manager()
2012 : nullptr)); 2004 : nullptr));
2013 SSLErrorHandler::HandleSSLError(tab, cert_error, ssl_info, request_url, 2005 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info,
2014 options_mask, cert_reporter.Pass(), callback); 2006 request_url, options_mask,
2007 cert_reporter.Pass(), callback);
2015 } 2008 }
2016 2009
2017 void ChromeContentBrowserClient::SelectClientCertificate( 2010 void ChromeContentBrowserClient::SelectClientCertificate(
2018 content::WebContents* web_contents, 2011 content::WebContents* web_contents,
2019 net::SSLCertRequestInfo* cert_request_info, 2012 net::SSLCertRequestInfo* cert_request_info,
2020 scoped_ptr<content::ClientCertificateDelegate> delegate) { 2013 scoped_ptr<content::ClientCertificateDelegate> delegate) {
2021 prerender::PrerenderContents* prerender_contents = 2014 prerender::PrerenderContents* prerender_contents =
2022 prerender::PrerenderContents::FromWebContents(web_contents); 2015 prerender::PrerenderContents::FromWebContents(web_contents);
2023 if (prerender_contents) { 2016 if (prerender_contents) {
2024 prerender_contents->Destroy( 2017 prerender_contents->Destroy(
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 if (channel <= kMaxDisableEncryptionChannel) { 2773 if (channel <= kMaxDisableEncryptionChannel) {
2781 static const char* const kWebRtcDevSwitchNames[] = { 2774 static const char* const kWebRtcDevSwitchNames[] = {
2782 switches::kDisableWebRtcEncryption, 2775 switches::kDisableWebRtcEncryption,
2783 }; 2776 };
2784 to_command_line->CopySwitchesFrom(from_command_line, 2777 to_command_line->CopySwitchesFrom(from_command_line,
2785 kWebRtcDevSwitchNames, 2778 kWebRtcDevSwitchNames,
2786 arraysize(kWebRtcDevSwitchNames)); 2779 arraysize(kWebRtcDevSwitchNames));
2787 } 2780 }
2788 } 2781 }
2789 #endif // defined(ENABLE_WEBRTC) 2782 #endif // defined(ENABLE_WEBRTC)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698