OLD | NEW |
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 content::ResourceRequestInfo::ForRequest(request); | 214 content::ResourceRequestInfo::ForRequest(request); |
215 | 215 |
216 // We always push the throttles here. Checking the existence of io_client | 216 // We always push the throttles here. Checking the existence of io_client |
217 // is racy when a popup window is created. That is because RequestBeginning | 217 // is racy when a popup window is created. That is because RequestBeginning |
218 // is called whether or not requests are blocked via BlockRequestForRoute() | 218 // is called whether or not requests are blocked via BlockRequestForRoute() |
219 // however io_client may or may not be ready at the time depending on whether | 219 // however io_client may or may not be ready at the time depending on whether |
220 // webcontents is created. | 220 // webcontents is created. |
221 throttles->push_back(new IoThreadClientThrottle( | 221 throttles->push_back(new IoThreadClientThrottle( |
222 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); | 222 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); |
223 | 223 |
224 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME || | |
225 (resource_type == content::RESOURCE_TYPE_SUB_FRAME && | |
226 !request->url().SchemeIs(url::kHttpScheme) && | |
227 !request->url().SchemeIs(url::kHttpsScheme) && | |
228 !request->url().SchemeIs(url::kAboutScheme))) { | |
229 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( | |
230 request)); | |
231 } | |
232 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) | 224 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) |
233 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); | 225 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); |
234 } | 226 } |
235 | 227 |
236 void AwResourceDispatcherHostDelegate::OnRequestRedirected( | 228 void AwResourceDispatcherHostDelegate::OnRequestRedirected( |
237 const GURL& redirect_url, | 229 const GURL& redirect_url, |
238 net::URLRequest* request, | 230 net::URLRequest* request, |
239 content::ResourceContext* resource_context, | 231 content::ResourceContext* resource_context, |
240 content::ResourceResponse* response) { | 232 content::ResourceResponse* response) { |
241 AddExtraHeadersIfNeeded(request, resource_context); | 233 AddExtraHeadersIfNeeded(request, resource_context); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 net::HttpRequestHeaders headers; | 431 net::HttpRequestHeaders headers; |
440 headers.AddHeadersFromString(extra_headers); | 432 headers.AddHeadersFromString(extra_headers); |
441 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 433 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
442 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 434 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
443 } | 435 } |
444 } | 436 } |
445 } | 437 } |
446 } | 438 } |
447 | 439 |
448 } // namespace android_webview | 440 } // namespace android_webview |
OLD | NEW |