| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 void AwResourceDispatcherHostDelegate::AddExtraHeadersIfNeeded( | 399 void AwResourceDispatcherHostDelegate::AddExtraHeadersIfNeeded( |
| 400 net::URLRequest* request, | 400 net::URLRequest* request, |
| 401 content::ResourceContext* resource_context) { | 401 content::ResourceContext* resource_context) { |
| 402 const content::ResourceRequestInfo* request_info = | 402 const content::ResourceRequestInfo* request_info = |
| 403 content::ResourceRequestInfo::ForRequest(request); | 403 content::ResourceRequestInfo::ForRequest(request); |
| 404 if (!request_info) | 404 if (!request_info) |
| 405 return; | 405 return; |
| 406 if (request_info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME) | 406 if (request_info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME) |
| 407 return; | 407 return; |
| 408 | 408 |
| 409 const content::PageTransition transition = request_info->GetPageTransition(); | 409 const ui::PageTransition transition = request_info->GetPageTransition(); |
| 410 const bool is_load_url = | 410 const bool is_load_url = |
| 411 transition & content::PAGE_TRANSITION_FROM_API; | 411 transition & ui::PAGE_TRANSITION_FROM_API; |
| 412 const bool is_go_back_forward = | 412 const bool is_go_back_forward = |
| 413 transition & content::PAGE_TRANSITION_FORWARD_BACK; | 413 transition & ui::PAGE_TRANSITION_FORWARD_BACK; |
| 414 const bool is_reload = content::PageTransitionCoreTypeIs( | 414 const bool is_reload = ui::PageTransitionCoreTypeIs( |
| 415 transition, content::PAGE_TRANSITION_RELOAD); | 415 transition, ui::PAGE_TRANSITION_RELOAD); |
| 416 if (is_load_url || is_go_back_forward || is_reload) { | 416 if (is_load_url || is_go_back_forward || is_reload) { |
| 417 AwResourceContext* awrc = static_cast<AwResourceContext*>(resource_context); | 417 AwResourceContext* awrc = static_cast<AwResourceContext*>(resource_context); |
| 418 std::string extra_headers = awrc->GetExtraHeaders(request->url()); | 418 std::string extra_headers = awrc->GetExtraHeaders(request->url()); |
| 419 if (!extra_headers.empty()) { | 419 if (!extra_headers.empty()) { |
| 420 net::HttpRequestHeaders headers; | 420 net::HttpRequestHeaders headers; |
| 421 headers.AddHeadersFromString(extra_headers); | 421 headers.AddHeadersFromString(extra_headers); |
| 422 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { | 422 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { |
| 423 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); | 423 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace android_webview | 429 } // namespace android_webview |
| OLD | NEW |