diff options
author | clamy <clamy@chromium.org> | 2015-09-21 19:18:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-22 02:19:35 +0000 |
commit | 394057986ff5d00a841a976f3bd8d599603acaa1 (patch) | |
tree | 3cf339bca77629de8a2d9a5d00e1cc793c9020f2 /android_webview | |
parent | d3090238be5465186fb991d306b4911c407bc6b8 (diff) | |
download | chromium_src-394057986ff5d00a841a976f3bd8d599603acaa1.zip chromium_src-394057986ff5d00a841a976f3bd8d599603acaa1.tar.gz chromium_src-394057986ff5d00a841a976f3bd8d599603acaa1.tar.bz2 |
Add a NavigationThrottle to the public content/ interface
This CL adds a NavigationThrottle class to the public content/ interface. A NavigationThrottle is used to control the flow of navigations. It lives entirely on the UI thread. Eventually, all components that want the functionality of a ResourceThrottle for navigations should transition to a NavigationThrottle: the new architecture for navigations (browser-side navigation) will not support ResourceThrottles for main resources load. See https://docs.google.com/document/d/1ICLLQoC9EsZ-bWH4ZKRhPCIoZKn6pOj02SlGl6SKH6Y/edit?pli=1#heading=h.fmxjmgvbgg7x for the design doc.
This Cl also transition the InterceptNavigationresourceThrottle to the Navigationthrottle model.
BUG=504347
Review URL: https://codereview.chromium.org/1269813002
Cr-Commit-Position: refs/heads/master@{#350092}
Diffstat (limited to 'android_webview')
3 files changed, 21 insertions, 8 deletions
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index 759c844..ab14d49 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc @@ -25,10 +25,13 @@ #include "base/command_line.h" #include "base/path_service.h" #include "components/cdm/browser/cdm_message_filter_android.h" +#include "components/navigation_interception/intercept_navigation_delegate.h" #include "content/public/browser/access_token_store.h" #include "content/public/browser/browser_message_filter.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" @@ -487,6 +490,22 @@ void AwContentBrowserClient::OverrideWebkitPrefs( content::WebContents::FromRenderViewHost(rvh), web_prefs); } +ScopedVector<content::NavigationThrottle> +AwContentBrowserClient::CreateThrottlesForNavigation( + content::NavigationHandle* navigation_handle) { + ScopedVector<content::NavigationThrottle> throttles; + if (navigation_handle->IsInMainFrame() || + (!navigation_handle->GetURL().SchemeIs(url::kHttpScheme) && + !navigation_handle->GetURL().SchemeIs(url::kHttpsScheme) && + !navigation_handle->GetURL().SchemeIs(url::kAboutScheme))) { + throttles.push_back( + navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( + navigation_handle) + .Pass()); + } + return throttles.Pass(); +} + #if defined(VIDEO_HOLE) content::ExternalVideoSurfaceContainer* AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index d811cf2..a3a814e 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h @@ -142,6 +142,8 @@ class AwContentBrowserClient : public content::ContentBrowserClient { std::map<int, base::MemoryMappedFile::Region>* regions) override; void OverrideWebkitPrefs(content::RenderViewHost* rvh, content::WebPreferences* web_prefs) override; + ScopedVector<content::NavigationThrottle> CreateThrottlesForNavigation( + content::NavigationHandle* navigation_handle) override; #if defined(VIDEO_HOLE) content::ExternalVideoSurfaceContainer* OverrideCreateExternalVideoSurfaceContainer( diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc index 1d9e585..ed7c52b 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc @@ -221,14 +221,6 @@ void AwResourceDispatcherHostDelegate::RequestBeginning( throttles->push_back(new IoThreadClientThrottle( request_info->GetChildID(), request_info->GetRenderFrameID(), request)); - if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || - (resource_type == content::RESOURCE_TYPE_SUB_FRAME && - !request->url().SchemeIs(url::kHttpScheme) && - !request->url().SchemeIs(url::kHttpsScheme) && - !request->url().SchemeIs(url::kAboutScheme))) { - throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( - request)); - } if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); } |