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

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

Issue 2393633006: Send net's ReferrerPolicy back to Blink while following redirects (Closed)
Patch Set: Remove unnecessary referrer calculation in DocumentThreadableLoader Created 4 years, 2 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 (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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 GURL referrer_url(referrer); 483 GURL referrer_url(referrer);
484 if (referrer_url.is_valid()) { 484 if (referrer_url.is_valid()) {
485 referrer_ = referrer_url.GetAsReferrer().spec(); 485 referrer_ = referrer_url.GetAsReferrer().spec();
486 } else { 486 } else {
487 referrer_ = referrer; 487 referrer_ = referrer;
488 } 488 }
489 } 489 }
490 490
491 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { 491 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) {
492 DCHECK(!is_pending_); 492 DCHECK(!is_pending_);
493 // External callers shouldn't be setting NO_REFERRER or
494 // ORIGIN. |referrer_policy_| is only applied during server redirects,
495 // so external callers must set the referrer themselves using
496 // SetReferrer() for the initial request. Once the referrer has been
497 // set to an origin or to an empty string, there is no point in
498 // setting the policy to NO_REFERRER or ORIGIN as it would have the
499 // same effect as using NEVER_CLEAR_REFERRER across redirects.
500 DCHECK_NE(referrer_policy, NO_REFERRER);
501 DCHECK_NE(referrer_policy, ORIGIN);
502 referrer_policy_ = referrer_policy; 493 referrer_policy_ = referrer_policy;
503 } 494 }
504 495
505 void URLRequest::set_delegate(Delegate* delegate) { 496 void URLRequest::set_delegate(Delegate* delegate) {
506 DCHECK(!delegate_); 497 DCHECK(!delegate_);
507 DCHECK(delegate); 498 DCHECK(delegate);
508 delegate_ = delegate; 499 delegate_ = delegate;
509 } 500 }
510 501
511 void URLRequest::Start() { 502 void URLRequest::Start() {
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 out->clear(); 1224 out->clear();
1234 } 1225 }
1235 1226
1236 void URLRequest::set_status(URLRequestStatus status) { 1227 void URLRequest::set_status(URLRequestStatus status) {
1237 DCHECK(status_.is_io_pending() || status_.is_success() || 1228 DCHECK(status_.is_io_pending() || status_.is_success() ||
1238 (!status.is_success() && !status.is_io_pending())); 1229 (!status.is_success() && !status.is_io_pending()));
1239 status_ = status; 1230 status_ = status;
1240 } 1231 }
1241 1232
1242 } // namespace net 1233 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698