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

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

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

Powered by Google App Engine
This is Rietveld 408576698