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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1357803004: Reland of Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Created 5 years, 3 months 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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 25f4aa462679cd10704c7256488f194bcad52df4..bbe1c07e906f1ad7b85ba0f40cef7f22d033dab2 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"
@@ -120,6 +121,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"
@@ -173,6 +176,7 @@
#include "chrome/browser/chrome_browser_main_android.h"
#include "chrome/common/descriptors_android.h"
#include "components/crash/content/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)
@@ -2598,6 +2602,34 @@
}
}
+ScopedVector<content::NavigationThrottle>
+ChromeContentBrowserClient::CreateThrottlesForNavigation(
+ content::NavigationHandle* handle) {
+ ScopedVector<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(handle->GetWebContents());
+ if (!prerender_contents && handle->IsInMainFrame()) {
+ throttles.push_back(
+ navigation_interception::InterceptNavigationDelegate::CreateThrottleFor(
+ handle)
+ .Pass());
+ }
+#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);
+ if (url_to_app_throttle)
+ throttles.push_back(url_to_app_throttle.Pass());
+ }
+#endif
+ return throttles.Pass();
+}
+
content::DevToolsManagerDelegate*
ChromeContentBrowserClient::GetDevToolsManagerDelegate() {
return new ChromeDevToolsManagerDelegate();

Powered by Google App Engine
This is Rietveld 408576698