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..9adf716bda217a7e5592c5446a1022ee448d0537 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" |
| @@ -119,6 +120,8 @@ |
| #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_handle.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" |
| @@ -172,6 +175,7 @@ |
| #include "chrome/browser/chrome_browser_main_android.h" |
| #include "chrome/common/descriptors_android.h" |
| #include "components/crash/browser/crash_dump_manager_android.h" |
| +#include "components/navigation_interception/intercept_navigation_delegate.h" |
| #include "components/service_tab_launcher/browser/android/service_tab_launcher.h" |
| #include "ui/base/resource/resource_bundle_android.h" |
| #elif defined(OS_POSIX) |
| @@ -2546,6 +2550,34 @@ void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, |
| } |
| } |
| +std::vector<content::NavigationThrottle*> |
| +ChromeContentBrowserClient::AddNavigationThrottles( |
|
nasko
2015/09/04 23:36:49
This method doesn't really add anything, maybe Get
clamy
2015/09/08 16:27:18
Done.
|
| + content::NavigationHandle* handle, |
| + WebContents* web_contents) { |
| + std::vector<content::NavigationThrottle*> throttles; |
| +#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()) { |
| + throttles.push_back( |
| + 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). |
| + content::NavigationThrottle* url_to_app_throttle = |
| + AppUrlRedirector::MaybeCreateThrottleFor(handle, web_contents); |
| + if (url_to_app_throttle) |
| + throttles.push_back(url_to_app_throttle); |
| + } |
| +#endif |
| + return throttles; |
| +} |
| + |
| content::DevToolsManagerDelegate* |
| ChromeContentBrowserClient::GetDevToolsManagerDelegate() { |
| return new ChromeDevToolsManagerDelegate(); |