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

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

Issue 1032063002: Enable 'First-Party-Only' cookies by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 5 years, 9 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_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad, 609 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad,
610 weak_factory_.GetWeakPtr())); 610 weak_factory_.GetWeakPtr()));
611 } else { 611 } else {
612 DoStartTransaction(); 612 DoStartTransaction();
613 } 613 }
614 } 614 }
615 615
616 void URLRequestHttpJob::DoLoadCookies() { 616 void URLRequestHttpJob::DoLoadCookies() {
617 CookieOptions options; 617 CookieOptions options;
618 options.set_include_httponly(); 618 options.set_include_httponly();
619 619 options.set_first_party_url(request_->first_party_for_cookies());
620 // TODO(mkwst): Drop this `if` once we decide whether or not to ship
621 // first-party cookies: https://crbug.com/459154
622 if (network_delegate() &&
623 network_delegate()->FirstPartyOnlyCookieExperimentEnabled())
624 options.set_first_party_url(request_->first_party_for_cookies());
625 else
626 options.set_include_first_party_only();
627 620
628 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( 621 request_->context()->cookie_store()->GetCookiesWithOptionsAsync(
629 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, 622 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded,
630 weak_factory_.GetWeakPtr())); 623 weak_factory_.GetWeakPtr()));
631 } 624 }
632 625
633 void URLRequestHttpJob::CheckCookiePolicyAndLoad( 626 void URLRequestHttpJob::CheckCookiePolicyAndLoad(
634 const CookieList& cookie_list) { 627 const CookieList& cookie_list) {
635 if (CanGetCookies(cookie_list)) 628 if (CanGetCookies(cookie_list))
636 DoLoadCookies(); 629 DoLoadCookies();
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 return override_response_headers_.get() ? 1481 return override_response_headers_.get() ?
1489 override_response_headers_.get() : 1482 override_response_headers_.get() :
1490 transaction_->GetResponseInfo()->headers.get(); 1483 transaction_->GetResponseInfo()->headers.get();
1491 } 1484 }
1492 1485
1493 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1486 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1494 awaiting_callback_ = false; 1487 awaiting_callback_ = false;
1495 } 1488 }
1496 1489
1497 } // namespace net 1490 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698