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

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: mmenke Created 5 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
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 DCHECK(!is_pending_); 456 DCHECK(!is_pending_);
457 first_party_for_cookies_ = first_party_for_cookies; 457 first_party_for_cookies_ = first_party_for_cookies;
458 } 458 }
459 459
460 void URLRequest::set_first_party_url_policy( 460 void URLRequest::set_first_party_url_policy(
461 FirstPartyURLPolicy first_party_url_policy) { 461 FirstPartyURLPolicy first_party_url_policy) {
462 DCHECK(!is_pending_); 462 DCHECK(!is_pending_);
463 first_party_url_policy_ = first_party_url_policy; 463 first_party_url_policy_ = first_party_url_policy;
464 } 464 }
465 465
466 void URLRequest::set_initiator(const url::Origin& initiator) {
467 DCHECK(!is_pending_);
468 initiator_ = initiator;
469 }
470
466 void URLRequest::set_method(const std::string& method) { 471 void URLRequest::set_method(const std::string& method) {
467 DCHECK(!is_pending_); 472 DCHECK(!is_pending_);
468 method_ = method; 473 method_ = method;
469 } 474 }
470 475
476 bool URLRequest::IsMethodSafe() const {
477 return method_ == "GET" || method_ == "HEAD" || method_ == "OPTIONS" ||
478 method_ == "TRACE";
479 }
480
471 void URLRequest::SetReferrer(const std::string& referrer) { 481 void URLRequest::SetReferrer(const std::string& referrer) {
472 DCHECK(!is_pending_); 482 DCHECK(!is_pending_);
473 GURL referrer_url(referrer); 483 GURL referrer_url(referrer);
474 if (referrer_url.is_valid()) { 484 if (referrer_url.is_valid()) {
475 referrer_ = referrer_url.GetAsReferrer().spec(); 485 referrer_ = referrer_url.GetAsReferrer().spec();
476 } else { 486 } else {
477 referrer_ = referrer; 487 referrer_ = referrer;
478 } 488 }
479 } 489 }
480 490
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1207 }
1198 1208
1199 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { 1209 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const {
1200 if (job_) 1210 if (job_)
1201 job_->GetConnectionAttempts(out); 1211 job_->GetConnectionAttempts(out);
1202 else 1212 else
1203 out->clear(); 1213 out->clear();
1204 } 1214 }
1205 1215
1206 } // namespace net 1216 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698