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

Side by Side Diff: android_webview/renderer/aw_content_renderer_client.cc

Issue 2498463002: RenderWidget/RenderView: encapsulate ViewHostMsg_Show, etc, in a callback (Closed)
Patch Set: Fixes. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/renderer/aw_content_renderer_client.h" 5 #include "android_webview/renderer/aw_content_renderer_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "android_webview/common/aw_resource.h" 9 #include "android_webview/common/aw_resource.h"
10 #include "android_webview/common/aw_switches.h" 10 #include "android_webview/common/aw_switches.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (!spellcheck_) { 85 if (!spellcheck_) {
86 spellcheck_ = base::MakeUnique<SpellCheck>(); 86 spellcheck_ = base::MakeUnique<SpellCheck>();
87 thread->AddObserver(spellcheck_.get()); 87 thread->AddObserver(spellcheck_.get());
88 } 88 }
89 #endif 89 #endif
90 } 90 }
91 91
92 bool AwContentRendererClient::HandleNavigation( 92 bool AwContentRendererClient::HandleNavigation(
93 content::RenderFrame* render_frame, 93 content::RenderFrame* render_frame,
94 bool is_content_initiated, 94 bool is_content_initiated,
95 int opener_id, 95 bool render_view_was_created_by_renderer,
96 blink::WebFrame* frame, 96 blink::WebFrame* frame,
97 const blink::WebURLRequest& request, 97 const blink::WebURLRequest& request,
98 blink::WebNavigationType type, 98 blink::WebNavigationType type,
99 blink::WebNavigationPolicy default_policy, 99 blink::WebNavigationPolicy default_policy,
100 bool is_redirect) { 100 bool is_redirect) {
101 // Only GETs can be overridden. 101 // Only GETs can be overridden.
102 if (!request.httpMethod().equals("GET")) 102 if (!request.httpMethod().equals("GET"))
103 return false; 103 return false;
104 104
105 // Any navigation from loadUrl, and goBack/Forward are considered application- 105 // Any navigation from loadUrl, and goBack/Forward are considered application-
(...skipping 16 matching lines...) Expand all
122 // For HTTP schemes, only top-level navigations can be overridden. Similarly, 122 // For HTTP schemes, only top-level navigations can be overridden. Similarly,
123 // WebView Classic lets app override only top level about:blank navigations. 123 // WebView Classic lets app override only top level about:blank navigations.
124 // So we filter out non-top about:blank navigations here. 124 // So we filter out non-top about:blank navigations here.
125 if (!is_main_frame && 125 if (!is_main_frame &&
126 (gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme) || 126 (gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme) ||
127 gurl.SchemeIs(url::kAboutScheme))) 127 gurl.SchemeIs(url::kAboutScheme)))
128 return false; 128 return false;
129 129
130 // use NavigationInterception throttle to handle the call as that can 130 // use NavigationInterception throttle to handle the call as that can
131 // be deferred until after the java side has been constructed. 131 // be deferred until after the java side has been constructed.
132 if (opener_id != MSG_ROUTING_NONE) { 132 //
133 // TODO(nick): |render_view_was_created_by_renderer| was plumbed in to
134 // preserve the existing code behavior, but it doesn't appear to be correct.
135 // In particular, this value will be true for the initial navigation of a
136 // RenderView created via window.open(), but it will also be true for all
137 // subsequent navigations in that RenderView, no matter how they are
138 // initiated.
sgurun-gerrit only 2016/11/21 21:17:25 yes, we have many bugs we are receiving there. but
139 if (render_view_was_created_by_renderer) {
133 return false; 140 return false;
134 } 141 }
135 142
136 bool ignore_navigation = false; 143 bool ignore_navigation = false;
137 base::string16 url = request.url().string(); 144 base::string16 url = request.url().string();
138 bool has_user_gesture = request.hasUserGesture(); 145 bool has_user_gesture = request.hasUserGesture();
139 146
140 int render_frame_id = render_frame->GetRoutingID(); 147 int render_frame_id = render_frame->GetRoutingID();
141 RenderThread::Get()->Send(new AwViewHostMsg_ShouldOverrideUrlLoading( 148 RenderThread::Get()->Send(new AwViewHostMsg_ShouldOverrideUrlLoading(
142 render_frame_id, url, has_user_gesture, is_redirect, is_main_frame, 149 render_frame_id, url, has_user_gesture, is_redirect, is_main_frame,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 for (auto* extension : kMediaPlayerExtensions) { 283 for (auto* extension : kMediaPlayerExtensions) {
277 if (base::EndsWith(url.path(), extension, 284 if (base::EndsWith(url.path(), extension,
278 base::CompareCase::INSENSITIVE_ASCII)) { 285 base::CompareCase::INSENSITIVE_ASCII)) {
279 return true; 286 return true;
280 } 287 }
281 } 288 }
282 return false; 289 return false;
283 } 290 }
284 291
285 } // namespace android_webview 292 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698