| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 AwResourceDispatcherHostDelegate::~AwResourceDispatcherHostDelegate() { | 207 AwResourceDispatcherHostDelegate::~AwResourceDispatcherHostDelegate() { |
| 208 } | 208 } |
| 209 | 209 |
| 210 void AwResourceDispatcherHostDelegate::RequestBeginning( | 210 void AwResourceDispatcherHostDelegate::RequestBeginning( |
| 211 net::URLRequest* request, | 211 net::URLRequest* request, |
| 212 content::ResourceContext* resource_context, | 212 content::ResourceContext* resource_context, |
| 213 content::AppCacheService* appcache_service, | 213 content::AppCacheService* appcache_service, |
| 214 ResourceType resource_type, | 214 ResourceType resource_type, |
| 215 int child_id, | |
| 216 int route_id, | |
| 217 ScopedVector<content::ResourceThrottle>* throttles) { | 215 ScopedVector<content::ResourceThrottle>* throttles) { |
| 218 | 216 |
| 219 AddExtraHeadersIfNeeded(request, resource_context); | 217 AddExtraHeadersIfNeeded(request, resource_context); |
| 220 | 218 |
| 221 const content::ResourceRequestInfo* request_info = | 219 const content::ResourceRequestInfo* request_info = |
| 222 content::ResourceRequestInfo::ForRequest(request); | 220 content::ResourceRequestInfo::ForRequest(request); |
| 223 | 221 |
| 224 // We always push the throttles here. Checking the existence of io_client | 222 // We always push the throttles here. Checking the existence of io_client |
| 225 // is racy when a popup window is created. That is because RequestBeginning | 223 // is racy when a popup window is created. That is because RequestBeginning |
| 226 // is called whether or not requests are blocked via BlockRequestForRoute() | 224 // is called whether or not requests are blocked via BlockRequestForRoute() |
| 227 // however io_client may or may not be ready at the time depending on whether | 225 // however io_client may or may not be ready at the time depending on whether |
| 228 // webcontents is created. | 226 // webcontents is created. |
| 229 throttles->push_back(new IoThreadClientThrottle( | 227 throttles->push_back(new IoThreadClientThrottle( |
| 230 child_id, request_info->GetRenderFrameID(), request)); | 228 request_info->GetChildID(), request_info->GetRenderFrameID(), request)); |
| 231 | 229 |
| 232 // We allow intercepting only navigations within main frames. This | 230 // We allow intercepting only navigations within main frames. This |
| 233 // is used to post onPageStarted. We handle shouldOverrideUrlLoading | 231 // is used to post onPageStarted. We handle shouldOverrideUrlLoading |
| 234 // via a sync IPC. | 232 // via a sync IPC. |
| 235 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) | 233 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) |
| 236 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( | 234 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( |
| 237 request)); | 235 request)); |
| 238 } | 236 } |
| 239 | 237 |
| 240 void AwResourceDispatcherHostDelegate::OnRequestRedirected( | 238 void AwResourceDispatcherHostDelegate::OnRequestRedirected( |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 net::HttpRequestHeaders headers; | 420 net::HttpRequestHeaders headers; |
| 423 headers.AddHeadersFromString(extra_headers); | 421 headers.AddHeadersFromString(extra_headers); |
| 424 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 422 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
| 425 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 423 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
| 426 } | 424 } |
| 427 } | 425 } |
| 428 } | 426 } |
| 429 } | 427 } |
| 430 | 428 |
| 431 } // namespace android_webview | 429 } // namespace android_webview |
| OLD | NEW |