Chromium Code Reviews| Index: chrome/browser/chrome_content_browser_client.cc |
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
| index cadc2bc89f51e56ee1bbbd3c273d6fa0d08f7ae4..63f5e46dd49b63ebd5843b4a6138caca3c492523 100644 |
| --- a/chrome/browser/chrome_content_browser_client.cc |
| +++ b/chrome/browser/chrome_content_browser_client.cc |
| @@ -24,6 +24,7 @@ |
| #include "base/thread_task_runner_handle.h" |
| #include "base/threading/sequenced_worker_pool.h" |
| #include "chrome/browser/after_startup_task_utils.h" |
| +#include "chrome/browser/apps/app_url_redirector.h" |
| #include "chrome/browser/browser_about_handler.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/browser_shutdown.h" |
| @@ -104,6 +105,7 @@ |
| #include "components/dom_distiller/core/url_constants.h" |
| #include "components/google/core/browser/google_util.h" |
| #include "components/metrics/client_info.h" |
| +#include "components/navigation_interception/intercept_navigation_delegate.h" |
| #include "components/pref_registry/pref_registry_syncable.h" |
| #include "components/rappor/rappor_utils.h" |
| #include "components/signin/core/common/profile_management_switches.h" |
| @@ -119,6 +121,7 @@ |
| #include "content/public/browser/child_process_data.h" |
| #include "content/public/browser/child_process_security_policy.h" |
| #include "content/public/browser/client_certificate_delegate.h" |
| +#include "content/public/browser/navigation_throttle.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/render_view_host.h" |
| @@ -2546,6 +2549,31 @@ void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
| } |
| } |
| +void ChromeContentBrowserClient::AddNavigationThrottles( |
| + content::NavigationHandle* handle, |
| + WebContents* web_contents) { |
| +#if defined(OS_ANDROID) |
| + // TODO(davidben): This is insufficient to integrate with prerender properly. |
| + // https://crbug.com/370595 |
| + prerender::PrerenderContents* prerender_contents = |
| + prerender::PrerenderContents::FromWebContents(web_contents); |
| + if (!prerender_contents && handle->IsInMainFrame()) { |
| + handle->RegisterThrottle( |
| + navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( |
| + handle, web_contents)); |
| + } |
| +#else |
| + if (handle->IsInMainFrame()) { |
| + // Redirect some navigations to apps that have registered matching URL |
| + // handlers ('url_handlers' in the manifest). |
| + scoped_ptr<content::NavigationThrottle> url_to_app_throttle = |
| + AppUrlRedirector::MaybeCreateThrottleFor(handle, web_contents); |
| + if (url_to_app_throttle) |
| + handle->RegisterThrottle(url_to_app_throttle.Pass()); |
| + } |
|
Avi (use Gerrit)
2015/09/01 16:38:47
Do we really want to do this for every WebContents
davidben
2015/09/01 21:55:17
+1. If we can manage it, I think WebContentsDelega
clamy
2015/09/03 15:30:51
I initially put that in WebContentsDelegate, but i
|
| +#endif |
| +} |
| + |
| content::DevToolsManagerDelegate* |
| ChromeContentBrowserClient::GetDevToolsManagerDelegate() { |
| return new ChromeDevToolsManagerDelegate(); |