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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.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: Feedback. Created 5 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 return; 1232 return;
1233 } 1233 }
1234 1234
1235 // Construct the request. 1235 // Construct the request.
1236 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest( 1236 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest(
1237 request_data.url, request_data.priority, NULL); 1237 request_data.url, request_data.priority, NULL);
1238 1238
1239 new_request->set_method(request_data.method); 1239 new_request->set_method(request_data.method);
1240 new_request->set_first_party_for_cookies( 1240 new_request->set_first_party_for_cookies(
1241 request_data.first_party_for_cookies); 1241 request_data.first_party_for_cookies);
1242 new_request->set_initiator(request_data.request_initiator);
mmenke 2015/10/21 15:36:38 What about ServiceWorker script requests, which is
mmenke 2015/10/21 15:36:38 What about AppCache?
Mike West 2015/10/22 13:17:02 Yup. I missed that. They should copy over the requ
mmenke 2015/10/22 19:41:05 I can't comment on that... Should we have some so
1242 1243
1243 // If the request is a MAIN_FRAME request, the first-party URL gets updated on 1244 // If the request is a MAIN_FRAME request, the first-party URL gets updated on
1244 // redirects. 1245 // redirects.
1245 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { 1246 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
1246 new_request->set_first_party_url_policy( 1247 new_request->set_first_party_url_policy(
1247 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 1248 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
1248 } 1249 }
1249 1250
1250 const Referrer referrer(request_data.referrer, request_data.referrer_policy); 1251 const Referrer referrer(request_data.referrer, request_data.referrer_policy);
1251 SetReferrerForRequest(new_request.get(), referrer); 1252 SetReferrerForRequest(new_request.get(), referrer);
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 // requests that have the ignore limits flag set. 2003 // requests that have the ignore limits flag set.
2003 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); 2004 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS));
2004 2005
2005 scoped_ptr<net::URLRequest> new_request; 2006 scoped_ptr<net::URLRequest> new_request;
2006 new_request = request_context->CreateRequest( 2007 new_request = request_context->CreateRequest(
2007 info.common_params.url, net::HIGHEST, nullptr); 2008 info.common_params.url, net::HIGHEST, nullptr);
2008 2009
2009 new_request->set_method(info.begin_params.method); 2010 new_request->set_method(info.begin_params.method);
2010 new_request->set_first_party_for_cookies( 2011 new_request->set_first_party_for_cookies(
2011 info.first_party_for_cookies); 2012 info.first_party_for_cookies);
2013 new_request->set_initiator(info.request_initiator);
2012 if (info.is_main_frame) { 2014 if (info.is_main_frame) {
2013 new_request->set_first_party_url_policy( 2015 new_request->set_first_party_url_policy(
2014 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 2016 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
2015 } 2017 }
2016 2018
2017 SetReferrerForRequest(new_request.get(), info.common_params.referrer); 2019 SetReferrerForRequest(new_request.get(), info.common_params.referrer);
2018 2020
2019 net::HttpRequestHeaders headers; 2021 net::HttpRequestHeaders headers;
2020 headers.AddHeadersFromString(info.begin_params.headers); 2022 headers.AddHeadersFromString(info.begin_params.headers);
2021 new_request->SetExtraRequestHeaders(headers); 2023 new_request->SetExtraRequestHeaders(headers);
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 load_flags |= net::LOAD_PREFETCH; 2428 load_flags |= net::LOAD_PREFETCH;
2427 } 2429 }
2428 2430
2429 if (is_sync_load) 2431 if (is_sync_load)
2430 load_flags |= net::LOAD_IGNORE_LIMITS; 2432 load_flags |= net::LOAD_IGNORE_LIMITS;
2431 2433
2432 return load_flags; 2434 return load_flags;
2433 } 2435 }
2434 2436
2435 } // namespace content 2437 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698