| Index: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| index 4e75cc968c7b5417e71123a87a27fc1a38096801..063460e8c548fe80a617907b4fdef2a54ba53df6 100644
|
| --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| @@ -65,6 +65,8 @@
|
| #if defined(OS_ANDROID)
|
| #include "chrome/browser/android/intercept_download_resource_throttle.h"
|
| #include "components/navigation_interception/intercept_navigation_delegate.h"
|
| +#else
|
| +#include "chrome/browser/apps/app_url_redirector.h"
|
| #endif
|
|
|
| #if defined(OS_CHROMEOS)
|
| @@ -263,12 +265,23 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
|
| request->SetPriority(net::IDLE);
|
| }
|
|
|
| -#if defined(OS_ANDROID)
|
| + ProfileIOData* io_data = ProfileIOData::FromResourceContext(
|
| + resource_context);
|
| +
|
| if (!is_prerendering && resource_type == ResourceType::MAIN_FRAME) {
|
| +#if defined(OS_ANDROID)
|
| throttles->push_back(
|
| InterceptNavigationDelegate::CreateThrottleFor(request));
|
| - }
|
| +#else
|
| + // Redirect some navigations to apps that have registered matching URL
|
| + // handlers ('url_handlers' in the manifest).
|
| + content::ResourceThrottle* url_to_app_throttle =
|
| + AppUrlRedirector::MaybeCreateThrottleFor(request, io_data);
|
| + if (url_to_app_throttle)
|
| + throttles->push_back(url_to_app_throttle);
|
| #endif
|
| + }
|
| +
|
| #if defined(OS_CHROMEOS)
|
| if (resource_type == ResourceType::MAIN_FRAME) {
|
| // We check offline first, then check safe browsing so that we still can
|
| @@ -289,8 +302,6 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
|
| if (!request->is_pending()) {
|
| net::HttpRequestHeaders headers;
|
| headers.CopyFrom(request->extra_request_headers());
|
| - ProfileIOData* io_data = ProfileIOData::FromResourceContext(
|
| - resource_context);
|
| bool incognito = io_data->is_incognito();
|
| chrome_variations::VariationsHttpHeaderProvider::GetInstance()->
|
| AppendHeaders(request->url(),
|
| @@ -311,7 +322,6 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
|
| resource_type,
|
| throttles);
|
|
|
| - ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
|
| if (io_data->resource_prefetch_predictor_observer()) {
|
| io_data->resource_prefetch_predictor_observer()->OnRequestStarted(
|
| request, resource_type, child_id, route_id);
|
|
|