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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2038813003: Making ResourceRequestBody part of //content's public API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/browser/frame_host/frame_tree_node.h" 11 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 12 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_handle_impl.h" 13 #include "content/browser/frame_host/navigation_handle_impl.h"
14 #include "content/browser/frame_host/navigation_request_info.h" 14 #include "content/browser/frame_host/navigation_request_info.h"
15 #include "content/browser/frame_host/navigator.h" 15 #include "content/browser/frame_host/navigator.h"
16 #include "content/browser/frame_host/navigator_impl.h" 16 #include "content/browser/frame_host/navigator_impl.h"
17 #include "content/browser/loader/navigation_url_loader.h" 17 #include "content/browser/loader/navigation_url_loader.h"
18 #include "content/browser/service_worker/service_worker_context_wrapper.h" 18 #include "content/browser/service_worker/service_worker_context_wrapper.h"
19 #include "content/browser/service_worker/service_worker_navigation_handle.h" 19 #include "content/browser/service_worker/service_worker_navigation_handle.h"
20 #include "content/browser/site_instance_impl.h" 20 #include "content/browser/site_instance_impl.h"
21 #include "content/common/resource_request_body.h" 21 #include "content/common/resource_request_body_impl.h"
22 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/navigation_controller.h" 23 #include "content/public/browser/navigation_controller.h"
24 #include "content/public/browser/navigation_data.h" 24 #include "content/public/browser/navigation_data.h"
25 #include "content/public/browser/storage_partition.h" 25 #include "content/public/browser/storage_partition.h"
26 #include "content/public/browser/stream_handle.h" 26 #include "content/public/browser/stream_handle.h"
27 #include "content/public/common/content_client.h" 27 #include "content/public/common/content_client.h"
28 #include "content/public/common/resource_response.h" 28 #include "content/public/common/resource_response.h"
29 #include "net/base/load_flags.h" 29 #include "net/base/load_flags.h"
30 #include "net/http/http_request_headers.h" 30 #include "net/http/http_request_headers.h"
31 #include "net/url_request/redirect_info.h" 31 #include "net/url_request/redirect_info.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const base::TimeTicks& navigation_start, 75 const base::TimeTicks& navigation_start,
76 NavigationControllerImpl* controller) { 76 NavigationControllerImpl* controller) {
77 // Copy existing headers and add necessary headers that may not be present 77 // Copy existing headers and add necessary headers that may not be present
78 // in the RequestNavigationParams. 78 // in the RequestNavigationParams.
79 net::HttpRequestHeaders headers; 79 net::HttpRequestHeaders headers;
80 headers.AddHeadersFromString(entry.extra_headers()); 80 headers.AddHeadersFromString(entry.extra_headers());
81 headers.SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent, 81 headers.SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent,
82 GetContentClient()->GetUserAgent()); 82 GetContentClient()->GetUserAgent());
83 83
84 // Fill POST data in the request body. 84 // Fill POST data in the request body.
85 scoped_refptr<ResourceRequestBody> request_body; 85 scoped_refptr<ResourceRequestBodyImpl> request_body;
86 if (frame_entry.method() == "POST") 86 if (frame_entry.method() == "POST")
87 request_body = frame_entry.GetPostData(); 87 request_body = frame_entry.GetPostData();
88 88
89 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( 89 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
90 frame_tree_node, entry.ConstructCommonNavigationParams( 90 frame_tree_node, entry.ConstructCommonNavigationParams(
91 frame_entry, request_body, dest_url, dest_referrer, 91 frame_entry, request_body, dest_url, dest_referrer,
92 navigation_type, lofi_state, navigation_start), 92 navigation_type, lofi_state, navigation_start),
93 BeginNavigationParams(headers.ToString(), 93 BeginNavigationParams(headers.ToString(),
94 LoadFlagFromNavigationType(navigation_type), 94 LoadFlagFromNavigationType(navigation_type),
95 false, // has_user_gestures 95 false, // has_user_gestures
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 browser_context, navigating_frame_host->GetSiteInstance()); 458 browser_context, navigating_frame_host->GetSiteInstance());
459 DCHECK(partition); 459 DCHECK(partition);
460 460
461 ServiceWorkerContextWrapper* service_worker_context = 461 ServiceWorkerContextWrapper* service_worker_context =
462 static_cast<ServiceWorkerContextWrapper*>( 462 static_cast<ServiceWorkerContextWrapper*>(
463 partition->GetServiceWorkerContext()); 463 partition->GetServiceWorkerContext());
464 navigation_handle_->InitServiceWorkerHandle(service_worker_context); 464 navigation_handle_->InitServiceWorkerHandle(service_worker_context);
465 } 465 }
466 466
467 } // namespace content 467 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/browser/frame_host/navigation_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698