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

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

Issue 1155713005: Use a resource throttle to implement shouldOverrideUrlLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot failure (use static inner class in instrumentation test) 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 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 content::ResourceRequestInfo::ForRequest(request); 219 content::ResourceRequestInfo::ForRequest(request);
220 220
221 // We always push the throttles here. Checking the existence of io_client 221 // We always push the throttles here. Checking the existence of io_client
222 // is racy when a popup window is created. That is because RequestBeginning 222 // is racy when a popup window is created. That is because RequestBeginning
223 // is called whether or not requests are blocked via BlockRequestForRoute() 223 // is called whether or not requests are blocked via BlockRequestForRoute()
224 // however io_client may or may not be ready at the time depending on whether 224 // however io_client may or may not be ready at the time depending on whether
225 // webcontents is created. 225 // webcontents is created.
226 throttles->push_back(new IoThreadClientThrottle( 226 throttles->push_back(new IoThreadClientThrottle(
227 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); 227 request_info->GetChildID(), request_info->GetRenderFrameID(), request));
228 228
229 // We allow intercepting only navigations within main frames. This 229 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME ||
230 // is used to post onPageStarted. We handle shouldOverrideUrlLoading 230 (resource_type == content::RESOURCE_TYPE_SUB_FRAME &&
231 // via a sync IPC. 231 !request->url().SchemeIs(url::kHttpScheme) &&
232 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { 232 !request->url().SchemeIs(url::kHttpsScheme) &&
233 !request->url().SchemeIs(url::kAboutScheme))) {
233 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( 234 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor(
234 request)); 235 request));
235 } else { 236 } else {
236 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); 237 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request);
sgurun-gerrit only 2015/07/08 01:08:54 so we do not enter updateusergesturecarryoverinfo
gsennton 2015/07/08 11:12:55 Right, I should have spotted this :(. So instead o
Jaekyun Seok (inactive) 2015/07/08 21:26:18 The latter seems correct. But is this to handle e
gsennton 2015/07/09 12:53:48 This is to call the shouldOverrideUrlLoading callb
Jaekyun Seok (inactive) 2015/07/09 20:33:58 InterceptNavigationDelegate#ShouldIgnoreNavigation
237 } 238 }
238 } 239 }
239 240
240 void AwResourceDispatcherHostDelegate::OnRequestRedirected( 241 void AwResourceDispatcherHostDelegate::OnRequestRedirected(
241 const GURL& redirect_url, 242 const GURL& redirect_url,
242 net::URLRequest* request, 243 net::URLRequest* request,
243 content::ResourceContext* resource_context, 244 content::ResourceContext* resource_context,
244 content::ResourceResponse* response) { 245 content::ResourceResponse* response) {
245 AddExtraHeadersIfNeeded(request, resource_context); 246 AddExtraHeadersIfNeeded(request, resource_context);
246 } 247 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 net::HttpRequestHeaders headers; 444 net::HttpRequestHeaders headers;
444 headers.AddHeadersFromString(extra_headers); 445 headers.AddHeadersFromString(extra_headers);
445 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { 446 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) {
446 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); 447 request->SetExtraRequestHeaderByName(it.name(), it.value(), false);
447 } 448 }
448 } 449 }
449 } 450 }
450 } 451 }
451 452
452 } // namespace android_webview 453 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698