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

Side by Side Diff: net/url_request/url_request.cc

Issue 714813003: Referrer Policy: Add new policies to URLRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests. Created 6 years, 1 month 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 | « net/url_request/url_request.h ('k') | net/url_request/url_request_job.h » ('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 (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 "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 job_->SetPriority(priority_); 643 job_->SetPriority(priority_);
644 644
645 if (upload_data_stream_.get()) 645 if (upload_data_stream_.get())
646 job_->SetUpload(upload_data_stream_.get()); 646 job_->SetUpload(upload_data_stream_.get());
647 647
648 is_pending_ = true; 648 is_pending_ = true;
649 is_redirecting_ = false; 649 is_redirecting_ = false;
650 650
651 response_info_.was_cached = false; 651 response_info_.was_cached = false;
652 652
653 // If the referrer is secure, but the requested URL is not, the referrer 653 if (GURL(referrer_) != URLRequestJob::ComputeReferrerForRedirect(
654 // policy should be something non-default. If you hit this, please file a 654 referrer_policy_, referrer_, url())) {
655 // bug.
656 if (referrer_policy_ ==
657 CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE &&
658 GURL(referrer_).SchemeIsSecure() && !url().SchemeIsSecure()) {
659 if (!network_delegate_ || 655 if (!network_delegate_ ||
660 !network_delegate_->CancelURLRequestWithPolicyViolatingReferrerHeader( 656 !network_delegate_->CancelURLRequestWithPolicyViolatingReferrerHeader(
661 *this, url(), GURL(referrer_))) { 657 *this, url(), GURL(referrer_))) {
662 referrer_.clear(); 658 referrer_.clear();
663 } else { 659 } else {
664 // We need to clear the referrer anyway to avoid an infinite recursion 660 // We need to clear the referrer anyway to avoid an infinite recursion
665 // when starting the error job. 661 // when starting the error job.
666 referrer_.clear(); 662 referrer_.clear();
667 std::string source("delegate"); 663 std::string source("delegate");
668 net_log_.AddEvent(NetLog::TYPE_CANCELLED, 664 net_log_.AddEvent(NetLog::TYPE_CANCELLED,
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 new base::debug::StackTrace(NULL, 0); 1225 new base::debug::StackTrace(NULL, 0);
1230 *stack_trace_copy = stack_trace; 1226 *stack_trace_copy = stack_trace;
1231 stack_trace_.reset(stack_trace_copy); 1227 stack_trace_.reset(stack_trace_copy);
1232 } 1228 }
1233 1229
1234 const base::debug::StackTrace* URLRequest::stack_trace() const { 1230 const base::debug::StackTrace* URLRequest::stack_trace() const {
1235 return stack_trace_.get(); 1231 return stack_trace_.get();
1236 } 1232 }
1237 1233
1238 } // namespace net 1234 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698