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

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 4 years 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 mojom::URLLoaderFactoryPtr factory; 411 mojom::URLLoaderFactoryPtr factory;
412 URLLoaderFactoryImpl::Create( 412 URLLoaderFactoryImpl::Create(
413 ResourceRequesterInfo::CreateForNavigationPreload(requester_info), 413 ResourceRequesterInfo::CreateForNavigationPreload(requester_info),
414 mojo::GetProxy(&url_loader_factory_)); 414 mojo::GetProxy(&url_loader_factory_));
415 415
416 preload_handle_ = mojom::FetchEventPreloadHandle::New(); 416 preload_handle_ = mojom::FetchEventPreloadHandle::New();
417 417
418 ResourceRequest request; 418 ResourceRequest request;
419 request.method = original_request->method(); 419 request.method = original_request->method();
420 request.url = original_request->url(); 420 request.url = original_request->url();
421 request.request_initiator = original_request->initiator(); 421 // TODO(horo): Set first_party_for_cookies to support Same-site Cookies.
422 request.request_initiator = original_request->initiator().has_value()
423 ? original_request->initiator()
424 : url::Origin(original_request->url());
422 request.referrer = GURL(original_request->referrer()); 425 request.referrer = GURL(original_request->referrer());
423 request.referrer_policy = original_info->GetReferrerPolicy(); 426 request.referrer_policy = original_info->GetReferrerPolicy();
424 request.visibility_state = original_info->GetVisibilityState(); 427 request.visibility_state = original_info->GetVisibilityState();
425 request.load_flags = original_request->load_flags(); 428 request.load_flags = original_request->load_flags();
426 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle 429 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle
427 // for the service worker navigation preload request. 430 // for the service worker navigation preload request.
428 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE; 431 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE;
429 request.priority = original_request->priority(); 432 request.priority = original_request->priority();
430 request.skip_service_worker = SkipServiceWorker::ALL; 433 request.skip_service_worker = SkipServiceWorker::ALL;
431 request.do_not_prompt_for_login = true; 434 request.do_not_prompt_for_login = true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 469 }
467 470
468 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 471 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
469 const { 472 const {
470 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 473 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
471 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 474 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
472 return ResourceTypeToEventType(resource_type_); 475 return ResourceTypeToEventType(resource_type_);
473 } 476 }
474 477
475 } // namespace content 478 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698