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

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

Issue 1411813003: Teach URLRequest about initiator checks for First-Party-Only cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 11 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 DCHECK(!is_pending_); 467 DCHECK(!is_pending_);
468 first_party_for_cookies_ = first_party_for_cookies; 468 first_party_for_cookies_ = first_party_for_cookies;
469 } 469 }
470 470
471 void URLRequest::set_first_party_url_policy( 471 void URLRequest::set_first_party_url_policy(
472 FirstPartyURLPolicy first_party_url_policy) { 472 FirstPartyURLPolicy first_party_url_policy) {
473 DCHECK(!is_pending_); 473 DCHECK(!is_pending_);
474 first_party_url_policy_ = first_party_url_policy; 474 first_party_url_policy_ = first_party_url_policy;
475 } 475 }
476 476
477 void URLRequest::set_initiator(const url::Origin& initiator) {
478 DCHECK(!is_pending_);
479 initiator_ = initiator;
480 }
481
477 void URLRequest::set_method(const std::string& method) { 482 void URLRequest::set_method(const std::string& method) {
478 DCHECK(!is_pending_); 483 DCHECK(!is_pending_);
479 method_ = method; 484 method_ = method;
480 } 485 }
481 486
487 bool URLRequest::IsMethodSafe() const {
488 return method_ == "GET" || method_ == "HEAD" || method_ == "OPTIONS" ||
489 method_ == "TRACE";
490 }
491
482 void URLRequest::SetReferrer(const std::string& referrer) { 492 void URLRequest::SetReferrer(const std::string& referrer) {
483 DCHECK(!is_pending_); 493 DCHECK(!is_pending_);
484 GURL referrer_url(referrer); 494 GURL referrer_url(referrer);
485 if (referrer_url.is_valid()) { 495 if (referrer_url.is_valid()) {
486 referrer_ = referrer_url.GetAsReferrer().spec(); 496 referrer_ = referrer_url.GetAsReferrer().spec();
487 } else { 497 } else {
488 referrer_ = referrer; 498 referrer_ = referrer;
489 } 499 }
490 } 500 }
491 501
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 } 1231 }
1222 1232
1223 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1233 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1224 if (job_) 1234 if (job_)
1225 job_->GetConnectionAttempts(out); 1235 job_->GetConnectionAttempts(out);
1226 else 1236 else
1227 out->clear(); 1237 out->clear();
1228 } 1238 }
1229 1239
1230 } // namespace net 1240 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698