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

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

Issue 2230103003: Propagate Origin header via CreateURLRequestForNavigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 4 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 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 531
532 WebURLRequest CreateURLRequestForNavigation( 532 WebURLRequest CreateURLRequestForNavigation(
533 const CommonNavigationParams& common_params, 533 const CommonNavigationParams& common_params,
534 std::unique_ptr<StreamOverrideParameters> stream_override, 534 std::unique_ptr<StreamOverrideParameters> stream_override,
535 bool is_view_source_mode_enabled) { 535 bool is_view_source_mode_enabled) {
536 WebURLRequest request(common_params.url); 536 WebURLRequest request(common_params.url);
537 if (is_view_source_mode_enabled) 537 if (is_view_source_mode_enabled)
538 request.setCachePolicy(WebCachePolicy::ReturnCacheDataElseLoad); 538 request.setCachePolicy(WebCachePolicy::ReturnCacheDataElseLoad);
539 539
540 request.setHTTPMethod(WebString::fromUTF8(common_params.method));
540 if (common_params.referrer.url.is_valid()) { 541 if (common_params.referrer.url.is_valid()) {
541 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( 542 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader(
542 common_params.referrer.policy, 543 common_params.referrer.policy,
543 common_params.url, 544 common_params.url,
544 WebString::fromUTF8(common_params.referrer.url.spec())); 545 WebString::fromUTF8(common_params.referrer.url.spec()));
545 if (!web_referrer.isEmpty()) 546 if (!web_referrer.isEmpty()) {
546 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); 547 request.setHTTPReferrer(web_referrer, common_params.referrer.policy);
548 request.addHTTPOriginIfNeeded(
549 WebSecurityOrigin(url::Origin(common_params.referrer.url))
jww 2016/08/12 21:10:54 This seems like an unnecessarily complex set of co
Łukasz Anforowicz 2016/08/12 22:09:43 Done (although it still needs an explicit std::str
550 .toString());
551 }
547 } 552 }
548 553
549 request.setHTTPMethod(WebString::fromUTF8(common_params.method));
550 request.setLoFiState( 554 request.setLoFiState(
551 static_cast<WebURLRequest::LoFiState>(common_params.lofi_state)); 555 static_cast<WebURLRequest::LoFiState>(common_params.lofi_state));
552 556
553 RequestExtraData* extra_data = new RequestExtraData(); 557 RequestExtraData* extra_data = new RequestExtraData();
554 extra_data->set_stream_override(std::move(stream_override)); 558 extra_data->set_stream_override(std::move(stream_override));
555 request.setExtraData(extra_data); 559 request.setExtraData(extra_data);
556 560
557 // Set the ui timestamp for this navigation. Currently the timestamp here is 561 // Set the ui timestamp for this navigation. Currently the timestamp here is
558 // only non empty when the navigation was triggered by an Android intent. The 562 // only non empty when the navigation was triggered by an Android intent. The
559 // timestamp is converted to a double version supported by blink. It will be 563 // timestamp is converted to a double version supported by blink. It will be
(...skipping 5755 matching lines...) Expand 10 before | Expand all | Expand 10 after
6315 // event target. Potentially a Pepper plugin will receive the event. 6319 // event target. Potentially a Pepper plugin will receive the event.
6316 // In order to tell whether a plugin gets the last mouse event and which it 6320 // In order to tell whether a plugin gets the last mouse event and which it
6317 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6321 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6318 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6322 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6319 // |pepper_last_mouse_event_target_|. 6323 // |pepper_last_mouse_event_target_|.
6320 pepper_last_mouse_event_target_ = nullptr; 6324 pepper_last_mouse_event_target_ = nullptr;
6321 #endif 6325 #endif
6322 } 6326 }
6323 6327
6324 } // namespace content 6328 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698