| OLD | NEW |
| 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 <stddef.h> | 9 #include <stddef.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 return; | 1324 return; |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 // Construct the request. | 1327 // Construct the request. |
| 1328 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest( | 1328 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest( |
| 1329 request_data.url, request_data.priority, NULL); | 1329 request_data.url, request_data.priority, NULL); |
| 1330 | 1330 |
| 1331 new_request->set_method(request_data.method); | 1331 new_request->set_method(request_data.method); |
| 1332 new_request->set_first_party_for_cookies( | 1332 new_request->set_first_party_for_cookies( |
| 1333 request_data.first_party_for_cookies); | 1333 request_data.first_party_for_cookies); |
| 1334 new_request->set_initiator(request_data.request_initiator); |
| 1334 | 1335 |
| 1335 // If the request is a MAIN_FRAME request, the first-party URL gets updated on | 1336 // If the request is a MAIN_FRAME request, the first-party URL gets updated on |
| 1336 // redirects. | 1337 // redirects. |
| 1337 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { | 1338 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { |
| 1338 new_request->set_first_party_url_policy( | 1339 new_request->set_first_party_url_policy( |
| 1339 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); | 1340 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
| 1340 } | 1341 } |
| 1341 | 1342 |
| 1342 const Referrer referrer(request_data.referrer, request_data.referrer_policy); | 1343 const Referrer referrer(request_data.referrer, request_data.referrer_policy); |
| 1343 SetReferrerForRequest(new_request.get(), referrer); | 1344 SetReferrerForRequest(new_request.get(), referrer); |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2112 // requests that have the ignore limits flag set. | 2113 // requests that have the ignore limits flag set. |
| 2113 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); | 2114 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); |
| 2114 | 2115 |
| 2115 scoped_ptr<net::URLRequest> new_request; | 2116 scoped_ptr<net::URLRequest> new_request; |
| 2116 new_request = request_context->CreateRequest( | 2117 new_request = request_context->CreateRequest( |
| 2117 info.common_params.url, net::HIGHEST, nullptr); | 2118 info.common_params.url, net::HIGHEST, nullptr); |
| 2118 | 2119 |
| 2119 new_request->set_method(info.begin_params.method); | 2120 new_request->set_method(info.begin_params.method); |
| 2120 new_request->set_first_party_for_cookies( | 2121 new_request->set_first_party_for_cookies( |
| 2121 info.first_party_for_cookies); | 2122 info.first_party_for_cookies); |
| 2123 new_request->set_initiator(info.request_initiator); |
| 2122 if (info.is_main_frame) { | 2124 if (info.is_main_frame) { |
| 2123 new_request->set_first_party_url_policy( | 2125 new_request->set_first_party_url_policy( |
| 2124 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); | 2126 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
| 2125 } | 2127 } |
| 2126 | 2128 |
| 2127 SetReferrerForRequest(new_request.get(), info.common_params.referrer); | 2129 SetReferrerForRequest(new_request.get(), info.common_params.referrer); |
| 2128 | 2130 |
| 2129 net::HttpRequestHeaders headers; | 2131 net::HttpRequestHeaders headers; |
| 2130 headers.AddHeadersFromString(info.begin_params.headers); | 2132 headers.AddHeadersFromString(info.begin_params.headers); |
| 2131 new_request->SetExtraRequestHeaders(headers); | 2133 new_request->SetExtraRequestHeaders(headers); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 load_flags |= net::LOAD_PREFETCH; | 2551 load_flags |= net::LOAD_PREFETCH; |
| 2550 } | 2552 } |
| 2551 | 2553 |
| 2552 if (is_sync_load) | 2554 if (is_sync_load) |
| 2553 load_flags |= net::LOAD_IGNORE_LIMITS; | 2555 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2554 | 2556 |
| 2555 return load_flags; | 2557 return load_flags; |
| 2556 } | 2558 } |
| 2557 | 2559 |
| 2558 } // namespace content | 2560 } // namespace content |
| OLD | NEW |