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

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

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Rewrite using base::Optional Created 4 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 <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 // stream that contains the response body of a navigation. Otherwise the data 1365 // stream that contains the response body of a navigation. Otherwise the data
1366 // that was already fetched by the browser will not be transmitted to the 1366 // that was already fetched by the browser will not be transmitted to the
1367 // renderer. 1367 // renderer.
1368 if (is_navigation_stream_request) 1368 if (is_navigation_stream_request)
1369 new_request->set_method("GET"); 1369 new_request->set_method("GET");
1370 else 1370 else
1371 new_request->set_method(request_data.method); 1371 new_request->set_method(request_data.method);
1372 1372
1373 new_request->set_first_party_for_cookies( 1373 new_request->set_first_party_for_cookies(
1374 request_data.first_party_for_cookies); 1374 request_data.first_party_for_cookies);
1375
1376 // The initiator should normally be present, unless this is a navigation in a
1377 // top-level frame. It may be null for some top-level navigations (eg:
1378 // browser-initiated ones).
1379 DCHECK(request_data.request_initiator.has_value() ||
1380 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME);
1375 new_request->set_initiator(request_data.request_initiator); 1381 new_request->set_initiator(request_data.request_initiator);
1376 1382
1377 if (request_data.originated_from_service_worker) { 1383 if (request_data.originated_from_service_worker) {
1378 new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey, 1384 new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey,
1379 new URLRequestServiceWorkerData()); 1385 new URLRequestServiceWorkerData());
1380 } 1386 }
1381 1387
1382 // If the request is a MAIN_FRAME request, the first-party URL gets updated on 1388 // If the request is a MAIN_FRAME request, the first-party URL gets updated on
1383 // redirects. 1389 // redirects.
1384 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { 1390 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 &throttles); 2739 &throttles);
2734 if (!throttles.empty()) { 2740 if (!throttles.empty()) {
2735 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2741 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2736 std::move(throttles))); 2742 std::move(throttles)));
2737 } 2743 }
2738 } 2744 }
2739 return handler; 2745 return handler;
2740 } 2746 }
2741 2747
2742 } // namespace content 2748 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698