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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Addressed comments + rebase Created 4 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 // 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 10
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 // stream that contains the response body of a navigation. Otherwise the data 1400 // stream that contains the response body of a navigation. Otherwise the data
1401 // that was already fetched by the browser will not be transmitted to the 1401 // that was already fetched by the browser will not be transmitted to the
1402 // renderer. 1402 // renderer.
1403 if (is_navigation_stream_request) 1403 if (is_navigation_stream_request)
1404 new_request->set_method("GET"); 1404 new_request->set_method("GET");
1405 else 1405 else
1406 new_request->set_method(request_data.method); 1406 new_request->set_method(request_data.method);
1407 1407
1408 new_request->set_first_party_for_cookies( 1408 new_request->set_first_party_for_cookies(
1409 request_data.first_party_for_cookies); 1409 request_data.first_party_for_cookies);
1410
1411 // The initiator should normally be present, unless this is a navigation in a
1412 // top-level frame. It may be null for some top-level navigations (eg:
1413 // browser-initiated ones).
1414 DCHECK(request_data.request_initiator.has_value() ||
1415 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME);
1410 new_request->set_initiator(request_data.request_initiator); 1416 new_request->set_initiator(request_data.request_initiator);
1411 1417
1412 if (request_data.originated_from_service_worker) { 1418 if (request_data.originated_from_service_worker) {
1413 new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey, 1419 new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey,
1414 new URLRequestServiceWorkerData()); 1420 new URLRequestServiceWorkerData());
1415 } 1421 }
1416 1422
1417 // If the request is a MAIN_FRAME request, the first-party URL gets updated on 1423 // If the request is a MAIN_FRAME request, the first-party URL gets updated on
1418 // redirects. 1424 // redirects.
1419 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { 1425 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 &throttles); 2791 &throttles);
2786 if (!throttles.empty()) { 2792 if (!throttles.empty()) {
2787 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2793 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2788 std::move(throttles))); 2794 std::move(throttles)));
2789 } 2795 }
2790 } 2796 }
2791 return handler; 2797 return handler;
2792 } 2798 }
2793 2799
2794 } // namespace content 2800 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698