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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1678303004: PlzNavigate: inform the renderer that a navigation is a POST (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 10 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
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 511
512 if (common_params.referrer.url.is_valid()) { 512 if (common_params.referrer.url.is_valid()) {
513 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( 513 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader(
514 common_params.referrer.policy, 514 common_params.referrer.policy,
515 common_params.url, 515 common_params.url,
516 WebString::fromUTF8(common_params.referrer.url.spec())); 516 WebString::fromUTF8(common_params.referrer.url.spec()));
517 if (!web_referrer.isEmpty()) 517 if (!web_referrer.isEmpty())
518 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); 518 request.setHTTPReferrer(web_referrer, common_params.referrer.policy);
519 } 519 }
520 520
521 request.setHTTPMethod(WebString::fromUTF8(common_params.method));
522
521 RequestExtraData* extra_data = new RequestExtraData(); 523 RequestExtraData* extra_data = new RequestExtraData();
522 extra_data->set_stream_override(std::move(stream_override)); 524 extra_data->set_stream_override(std::move(stream_override));
523 extra_data->set_lofi_state(common_params.lofi_state); 525 extra_data->set_lofi_state(common_params.lofi_state);
524 request.setExtraData(extra_data); 526 request.setExtraData(extra_data);
525 527
526 // Set the ui timestamp for this navigation. Currently the timestamp here is 528 // Set the ui timestamp for this navigation. Currently the timestamp here is
527 // only non empty when the navigation was triggered by an Android intent. The 529 // only non empty when the navigation was triggered by an Android intent. The
528 // timestamp is converted to a double version supported by blink. It will be 530 // timestamp is converted to a double version supported by blink. It will be
529 // passed back to the browser in the DidCommitProvisionalLoad and the 531 // passed back to the browser in the DidCommitProvisionalLoad and the
530 // DocumentLoadComplete IPCs. 532 // DocumentLoadComplete IPCs.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 588 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
587 request->inputPerfMetricReportPolicy()); 589 request->inputPerfMetricReportPolicy());
588 590
589 const RequestExtraData* extra_data = 591 const RequestExtraData* extra_data =
590 static_cast<RequestExtraData*>(request->extraData()); 592 static_cast<RequestExtraData*>(request->extraData());
591 DCHECK(extra_data); 593 DCHECK(extra_data);
592 return CommonNavigationParams( 594 return CommonNavigationParams(
593 request->url(), referrer, extra_data->transition_type(), 595 request->url(), referrer, extra_data->transition_type(),
594 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, 596 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry,
595 ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(), 597 ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(),
596 base::TimeTicks::Now()); 598 base::TimeTicks::Now(), request->httpMethod().latin1());
597 } 599 }
598 600
599 media::Context3D GetSharedMainThreadContext3D() { 601 media::Context3D GetSharedMainThreadContext3D() {
600 cc::ContextProvider* provider = 602 cc::ContextProvider* provider =
601 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 603 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
602 if (!provider) 604 if (!provider)
603 return media::Context3D(); 605 return media::Context3D();
604 return media::Context3D(provider->ContextGL(), provider->GrContext()); 606 return media::Context3D(provider->ContextGL(), provider->GrContext());
605 } 607 }
606 608
(...skipping 4844 matching lines...) Expand 10 before | Expand all | Expand 10 after
5451 if (!start_params.extra_headers.empty() && !browser_side_navigation) { 5453 if (!start_params.extra_headers.empty() && !browser_side_navigation) {
5452 for (net::HttpUtil::HeadersIterator i(start_params.extra_headers.begin(), 5454 for (net::HttpUtil::HeadersIterator i(start_params.extra_headers.begin(),
5453 start_params.extra_headers.end(), 5455 start_params.extra_headers.end(),
5454 "\n"); 5456 "\n");
5455 i.GetNext();) { 5457 i.GetNext();) {
5456 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), 5458 request.addHTTPHeaderField(WebString::fromUTF8(i.name()),
5457 WebString::fromUTF8(i.values())); 5459 WebString::fromUTF8(i.values()));
5458 } 5460 }
5459 } 5461 }
5460 5462
5461 if (start_params.is_post && !browser_side_navigation) { 5463 if (common_params.method == "POST" && !browser_side_navigation) {
5462 request.setHTTPMethod(WebString::fromUTF8("POST"));
Charlie Reis 2016/02/17 21:52:06 Sanity check: How does this happen now? The Creat
clamy 2016/02/22 12:48:36 Yes.
5463
5464 // Set post data. 5464 // Set post data.
5465 WebHTTPBody http_body; 5465 WebHTTPBody http_body;
5466 http_body.initialize(); 5466 http_body.initialize();
5467 const char* data = nullptr; 5467 const char* data = nullptr;
5468 if (start_params.browser_initiated_post_data.size()) { 5468 if (start_params.browser_initiated_post_data.size()) {
5469 data = reinterpret_cast<const char*>( 5469 data = reinterpret_cast<const char*>(
5470 &start_params.browser_initiated_post_data.front()); 5470 &start_params.browser_initiated_post_data.front());
5471 } 5471 }
5472 http_body.appendData( 5472 http_body.appendData(
5473 WebData(data, start_params.browser_initiated_post_data.size())); 5473 WebData(data, start_params.browser_initiated_post_data.size()));
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
5728 DCHECK(frame_->parent() || 5728 DCHECK(frame_->parent() ||
5729 GetRequestContextFrameTypeForWebURLRequest(*request) == 5729 GetRequestContextFrameTypeForWebURLRequest(*request) ==
5730 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL); 5730 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL);
5731 DCHECK(!frame_->parent() || 5731 DCHECK(!frame_->parent() ||
5732 GetRequestContextFrameTypeForWebURLRequest(*request) == 5732 GetRequestContextFrameTypeForWebURLRequest(*request) ==
5733 REQUEST_CONTEXT_FRAME_TYPE_NESTED); 5733 REQUEST_CONTEXT_FRAME_TYPE_NESTED);
5734 5734
5735 Send(new FrameHostMsg_BeginNavigation( 5735 Send(new FrameHostMsg_BeginNavigation(
5736 routing_id_, 5736 routing_id_,
5737 MakeCommonNavigationParams(request, should_replace_current_entry), 5737 MakeCommonNavigationParams(request, should_replace_current_entry),
5738 BeginNavigationParams( 5738 BeginNavigationParams(GetWebURLRequestHeaders(*request),
5739 request->httpMethod().latin1(), GetWebURLRequestHeaders(*request), 5739 GetLoadFlagsForWebURLRequest(*request),
5740 GetLoadFlagsForWebURLRequest(*request), request->hasUserGesture(), 5740 request->hasUserGesture(),
5741 request->skipServiceWorker(), 5741 request->skipServiceWorker(),
5742 GetRequestContextTypeForWebURLRequest(*request)), 5742 GetRequestContextTypeForWebURLRequest(*request)),
5743 GetRequestBodyForWebURLRequest(*request))); 5743 GetRequestBodyForWebURLRequest(*request)));
5744 } 5744 }
5745 5745
5746 void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params, 5746 void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params,
5747 const RequestNavigationParams& request_params, 5747 const RequestNavigationParams& request_params,
5748 WebFrame* frame, 5748 WebFrame* frame,
5749 blink::WebFrameLoadType load_type) { 5749 blink::WebFrameLoadType load_type) {
5750 // A loadData request with a specified base URL. 5750 // A loadData request with a specified base URL.
5751 GURL data_url = params.url; 5751 GURL data_url = params.url;
5752 #if defined(OS_ANDROID) 5752 #if defined(OS_ANDROID)
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
6110 int match_count, 6110 int match_count,
6111 int ordinal, 6111 int ordinal,
6112 const WebRect& selection_rect, 6112 const WebRect& selection_rect,
6113 bool final_status_update) { 6113 bool final_status_update) {
6114 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6114 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6115 selection_rect, ordinal, 6115 selection_rect, ordinal,
6116 final_status_update)); 6116 final_status_update));
6117 } 6117 }
6118 6118
6119 } // namespace content 6119 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698