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

Unified Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2538353002: fix external protocol handling for OOPIFs (Closed)
Patch Set: add check if runner is necessary Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
index e5a36cc6d8ca2e66af63e593511b455b1402a60d..a7a2352345b569cac82f69e4b83aadc0654b7d52 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -220,7 +220,6 @@ void SendExecuteMimeTypeHandlerEvent(
void LaunchURL(
const GURL& url,
- int render_process_id,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
ui::PageTransition page_transition,
bool has_user_gesture,
@@ -228,6 +227,8 @@ void LaunchURL(
// If there is no longer a WebContents, the request may have raced with tab
// closing. Don't fire the external request. (It may have been a prerender.)
content::WebContents* web_contents = web_contents_getter.Run();
+ int render_process_id =
alexmos 2016/12/12 21:11:40 The else {} below is the only place left where it'
davidsac (gone - try alexmos) 2016/12/13 23:02:33 Done.
+ web_contents->GetRenderViewHost()->GetProcess()->GetID();
if (!web_contents)
return;
@@ -246,9 +247,7 @@ void LaunchURL(
// TODO(davidsac): External protocol handling needs to be
// fixed for OOPIFs. See https://crbug.com/668289.
if (is_whitelisted) {
- ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(
- url, render_process_id,
- web_contents->GetRenderViewHost()->GetRoutingID());
+ ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url, web_contents);
} else {
ExternalProtocolHandler::LaunchUrlWithDelegate(
url, render_process_id,
@@ -566,11 +565,12 @@ bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
// content page.
return false;
}
- int child_id = info->GetChildID();
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
// External protocols are disabled for guests. An exception is made for the
// "mailto" protocol, so that pages that utilize it work properly in a
// WebView.
+ int child_id = info->GetChildID();
ChromeNavigationUIData* navigation_data =
static_cast<ChromeNavigationUIData*>(info->GetNavigationUIData());
if ((extensions::WebViewRendererState::GetInstance()->IsGuest(child_id) ||
@@ -592,8 +592,7 @@ bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
url_state == policy::URLBlacklist::URLBlacklistState::URL_IN_WHITELIST;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&LaunchURL, url, child_id,
- info->GetWebContentsGetterForRequest(),
+ base::Bind(&LaunchURL, url, info->GetWebContentsGetterForRequest(),
info->GetPageTransition(), info->HasUserGesture(),
is_whitelisted));
return true;

Powered by Google App Engine
This is Rietveld 408576698