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

Side by Side Diff: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc

Issue 24228003: Upstream ShouldOverrideUrlLoading changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed code review Created 7 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 5 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "android_webview/browser/aw_contents_io_thread_client.h" 9 #include "android_webview/browser/aw_contents_io_thread_client.h"
10 #include "android_webview/browser/aw_login_delegate.h" 10 #include "android_webview/browser/aw_login_delegate.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // request relates to a not-yet-created popup window, then the client will 216 // request relates to a not-yet-created popup window, then the client will
217 // be non-NULL but PopupPendingAssociation() will be set. 217 // be non-NULL but PopupPendingAssociation() will be set.
218 scoped_ptr<AwContentsIoThreadClient> io_client = 218 scoped_ptr<AwContentsIoThreadClient> io_client =
219 AwContentsIoThreadClient::FromID(child_id, route_id); 219 AwContentsIoThreadClient::FromID(child_id, route_id);
220 if (!io_client) 220 if (!io_client)
221 return; 221 return;
222 222
223 throttles->push_back(new IoThreadClientThrottle( 223 throttles->push_back(new IoThreadClientThrottle(
224 child_id, route_id, request)); 224 child_id, route_id, request));
225 225
226 bool allow_intercepting = 226 // We allow intercepting only navigations within main frames. This
mkosiba (inactive) 2013/10/17 10:27:45 This is misleading. We're not really using the thr
sgurun-gerrit only 2013/12/06 00:17:48 Done.
227 // We allow intercepting navigations within subframes, but only if the 227 // is used to post onPageStarted. We handle shouldOverrideUrlLoading
228 // scheme other than http or https. This is because the embedder 228 // via a sync IPC.
229 // can't distinguish main frame and subframe callbacks (which could lead 229 if (resource_type == ResourceType::MAIN_FRAME)
230 // to broken content if the embedder decides to not ignore the main frame
231 // navigation, but ignores the subframe navigation).
232 // The reason this is supported at all is that certain JavaScript-based
233 // frameworks use iframe navigation as a form of communication with the
234 // embedder.
235 (resource_type == ResourceType::MAIN_FRAME ||
236 (resource_type == ResourceType::SUB_FRAME &&
237 !request->url().SchemeIs(content::kHttpScheme) &&
238 !request->url().SchemeIs(content::kHttpsScheme)));
239 if (allow_intercepting) {
240 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( 230 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor(
241 request)); 231 request));
242 }
243 } 232 }
244 233
245 void AwResourceDispatcherHostDelegate::DownloadStarting( 234 void AwResourceDispatcherHostDelegate::DownloadStarting(
246 net::URLRequest* request, 235 net::URLRequest* request,
247 content::ResourceContext* resource_context, 236 content::ResourceContext* resource_context,
248 int child_id, 237 int child_id,
249 int route_id, 238 int route_id,
250 int request_id, 239 int request_id,
251 bool is_content_initiated, 240 bool is_content_initiated,
252 bool must_download, 241 bool must_download,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 ChildRouteIDPair(new_child_id, new_route_id)); 377 ChildRouteIDPair(new_child_id, new_route_id));
389 378
390 if (it != pending_throttles_.end()) { 379 if (it != pending_throttles_.end()) {
391 IoThreadClientThrottle* throttle = it->second; 380 IoThreadClientThrottle* throttle = it->second;
392 throttle->OnIoThreadClientReady(new_child_id, new_route_id); 381 throttle->OnIoThreadClientReady(new_child_id, new_route_id);
393 pending_throttles_.erase(it); 382 pending_throttles_.erase(it);
394 } 383 }
395 } 384 }
396 385
397 } // namespace android_webview 386 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698