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

Unified Diff: android_webview/renderer/aw_content_renderer_client.cc

Issue 1155713005: Use a resource throttle to implement shouldOverrideUrlLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix qinmin nit Created 5 years, 5 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: android_webview/renderer/aw_content_renderer_client.cc
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc
index b9c6a3d2e9a9b13d93a37a7fad03074c1c9b5253..79c33cf75ec4f55ae29ed85a7fae44d927eaf872 100644
--- a/android_webview/renderer/aw_content_renderer_client.cc
+++ b/android_webview/renderer/aw_content_renderer_client.cc
@@ -21,8 +21,6 @@
#include "components/printing/renderer/print_web_view_helper.h"
#include "components/visitedlink/renderer/visitedlink_slave.h"
#include "content/public/common/url_constants.h"
-#include "content/public/renderer/document_state.h"
-#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
@@ -33,7 +31,6 @@
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebNavigationType.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#include "url/gurl.h"
@@ -65,61 +62,6 @@ void AwContentRendererClient::RenderThreadStarted() {
thread->AddObserver(visited_link_slave_.get());
}
-bool AwContentRendererClient::HandleNavigation(
- content::RenderFrame* render_frame,
- content::DocumentState* document_state,
- int opener_id,
- blink::WebFrame* frame,
- const blink::WebURLRequest& request,
- blink::WebNavigationType type,
- blink::WebNavigationPolicy default_policy,
- bool is_redirect) {
-
- // Only GETs can be overridden.
- if (!request.httpMethod().equals("GET"))
- return false;
-
- // Any navigation from loadUrl, and goBack/Forward are considered application-
- // initiated and hence will not yield a shouldOverrideUrlLoading() callback.
- // Webview classic does not consider reload application-initiated so we
- // continue the same behavior.
- // TODO(sgurun) is_content_initiated is normally false for cross-origin
- // navigations but since android_webview does not swap out renderers, this
- // works fine. This will stop working if android_webview starts swapping out
- // renderers on navigation.
- bool application_initiated =
- !document_state->navigation_state()->IsContentInitiated() ||
- type == blink::WebNavigationTypeBackForward;
-
- // Don't offer application-initiated navigations unless it's a redirect.
- if (application_initiated && !is_redirect)
- return false;
-
- const GURL& gurl = request.url();
- // For HTTP schemes, only top-level navigations can be overridden. Similarly,
- // WebView Classic lets app override only top level about:blank navigations.
- // So we filter out non-top about:blank navigations here.
- if (frame->parent() &&
- (gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme) ||
- gurl.SchemeIs(url::kAboutScheme)))
- return false;
-
- // use NavigationInterception throttle to handle the call as that can
- // be deferred until after the java side has been constructed.
- if (opener_id != MSG_ROUTING_NONE) {
- return false;
- }
-
- bool ignore_navigation = false;
- base::string16 url = request.url().string();
- bool has_user_gesture = request.hasUserGesture();
-
- int render_frame_id = render_frame->GetRoutingID();
- RenderThread::Get()->Send(new AwViewHostMsg_ShouldOverrideUrlLoading(
- render_frame_id, url, has_user_gesture, is_redirect, &ignore_navigation));
- return ignore_navigation;
-}
-
void AwContentRendererClient::RenderFrameCreated(
content::RenderFrame* render_frame) {
new AwContentSettingsClient(render_frame);
« no previous file with comments | « android_webview/renderer/aw_content_renderer_client.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698