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

Side by Side Diff: content/browser/service_worker/service_worker_fetch_dispatcher.cc

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 3 years, 12 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" 5 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 mojom::URLLoaderFactoryPtr factory; 421 mojom::URLLoaderFactoryPtr factory;
422 URLLoaderFactoryImpl::Create( 422 URLLoaderFactoryImpl::Create(
423 ResourceRequesterInfo::CreateForNavigationPreload(requester_info), 423 ResourceRequesterInfo::CreateForNavigationPreload(requester_info),
424 mojo::MakeRequest(&url_loader_factory_)); 424 mojo::MakeRequest(&url_loader_factory_));
425 425
426 preload_handle_ = mojom::FetchEventPreloadHandle::New(); 426 preload_handle_ = mojom::FetchEventPreloadHandle::New();
427 427
428 ResourceRequest request; 428 ResourceRequest request;
429 request.method = original_request->method(); 429 request.method = original_request->method();
430 request.url = original_request->url(); 430 request.url = original_request->url();
431 request.request_initiator = original_request->initiator(); 431 // TODO(horo): Set first_party_for_cookies to support Same-site Cookies.
432 request.request_initiator = original_request->initiator().has_value()
433 ? original_request->initiator()
434 : url::Origin(original_request->url());
432 request.referrer = GURL(original_request->referrer()); 435 request.referrer = GURL(original_request->referrer());
433 request.referrer_policy = original_info->GetReferrerPolicy(); 436 request.referrer_policy = original_info->GetReferrerPolicy();
434 request.visibility_state = original_info->GetVisibilityState(); 437 request.visibility_state = original_info->GetVisibilityState();
435 request.load_flags = original_request->load_flags(); 438 request.load_flags = original_request->load_flags();
436 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle 439 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle
437 // for the service worker navigation preload request. 440 // for the service worker navigation preload request.
438 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE; 441 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE;
439 request.priority = original_request->priority(); 442 request.priority = original_request->priority();
440 request.skip_service_worker = SkipServiceWorker::ALL; 443 request.skip_service_worker = SkipServiceWorker::ALL;
441 request.do_not_prompt_for_login = true; 444 request.do_not_prompt_for_login = true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 479 }
477 480
478 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 481 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
479 const { 482 const {
480 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 483 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
481 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 484 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
482 return ResourceTypeToEventType(resource_type_); 485 return ResourceTypeToEventType(resource_type_);
483 } 486 }
484 487
485 } // namespace content 488 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_unittest.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698