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

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: Fixed issue in SW preload 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 request.request_initiator = original_request->initiator().has_value()
horo 2016/12/12 07:07:57 Please add this TODO comment: // TODO(horo): Set f
clamy 2016/12/12 16:52:33 Done.
422 ? original_request->initiator()
423 : url::Origin(original_request->url());
422 request.referrer = GURL(original_request->referrer()); 424 request.referrer = GURL(original_request->referrer());
423 request.referrer_policy = original_info->GetReferrerPolicy(); 425 request.referrer_policy = original_info->GetReferrerPolicy();
424 request.visibility_state = original_info->GetVisibilityState(); 426 request.visibility_state = original_info->GetVisibilityState();
425 request.load_flags = original_request->load_flags(); 427 request.load_flags = original_request->load_flags();
426 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle 428 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle
427 // for the service worker navigation preload request. 429 // for the service worker navigation preload request.
428 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE; 430 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE;
429 request.priority = original_request->priority(); 431 request.priority = original_request->priority();
430 request.skip_service_worker = SkipServiceWorker::ALL; 432 request.skip_service_worker = SkipServiceWorker::ALL;
431 request.do_not_prompt_for_login = true; 433 request.do_not_prompt_for_login = true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 468 }
467 469
468 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 470 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
469 const { 471 const {
470 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 472 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
471 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 473 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
472 return ResourceTypeToEventType(resource_type_); 474 return ResourceTypeToEventType(resource_type_);
473 } 475 }
474 476
475 } // namespace content 477 } // 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