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 } |
224 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) | 232 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) |
225 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); | 233 InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(request); |
226 } | 234 } |
227 | 235 |
228 void AwResourceDispatcherHostDelegate::OnRequestRedirected( | 236 void AwResourceDispatcherHostDelegate::OnRequestRedirected( |
229 const GURL& redirect_url, | 237 const GURL& redirect_url, |
230 net::URLRequest* request, | 238 net::URLRequest* request, |
231 content::ResourceContext* resource_context, | 239 content::ResourceContext* resource_context, |
232 content::ResourceResponse* response) { | 240 content::ResourceResponse* response) { |
233 AddExtraHeadersIfNeeded(request, resource_context); | 241 AddExtraHeadersIfNeeded(request, resource_context); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 net::HttpRequestHeaders headers; | 439 net::HttpRequestHeaders headers; |
432 headers.AddHeadersFromString(extra_headers); | 440 headers.AddHeadersFromString(extra_headers); |
433 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 441 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
434 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 442 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
435 } | 443 } |
436 } | 444 } |
437 } | 445 } |
438 } | 446 } |
439 | 447 |
440 } // namespace android_webview | 448 } // namespace android_webview |
OLD | NEW |