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

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

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Addressed comments + rebase 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 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 mojo::GetProxy(&factory)); 312 mojo::GetProxy(&factory));
313 313
314 preload_handle_ = mojom::FetchEventPreloadHandle::New(); 314 preload_handle_ = mojom::FetchEventPreloadHandle::New();
315 315
316 mojom::URLLoaderClientPtr url_loader_client; 316 mojom::URLLoaderClientPtr url_loader_client;
317 preload_handle_->url_loader_client_request = GetProxy(&url_loader_client); 317 preload_handle_->url_loader_client_request = GetProxy(&url_loader_client);
318 318
319 ResourceRequest request; 319 ResourceRequest request;
320 request.method = original_request->method(); 320 request.method = original_request->method();
321 request.url = original_request->url(); 321 request.url = original_request->url();
322 request.request_initiator = original_request->initiator();
322 request.referrer = GURL(original_request->referrer()); 323 request.referrer = GURL(original_request->referrer());
323 request.referrer_policy = original_info->GetReferrerPolicy(); 324 request.referrer_policy = original_info->GetReferrerPolicy();
324 request.visibility_state = original_info->GetVisibilityState(); 325 request.visibility_state = original_info->GetVisibilityState();
325 request.load_flags = original_request->load_flags(); 326 request.load_flags = original_request->load_flags();
326 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle 327 // Set to SUB_RESOURCE because we shouldn't trigger NavigationResourceThrottle
327 // for the service worker navigation preload request. 328 // for the service worker navigation preload request.
328 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE; 329 request.resource_type = RESOURCE_TYPE_SUB_RESOURCE;
329 request.priority = original_request->priority(); 330 request.priority = original_request->priority();
330 request.skip_service_worker = SkipServiceWorker::ALL; 331 request.skip_service_worker = SkipServiceWorker::ALL;
331 request.do_not_prompt_for_login = true; 332 request.do_not_prompt_for_login = true;
(...skipping 10 matching lines...) Expand all
342 } 343 }
343 344
344 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 345 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
345 const { 346 const {
346 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 347 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
347 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 348 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
348 return ResourceTypeToEventType(resource_type_); 349 return ResourceTypeToEventType(resource_type_);
349 } 350 }
350 351
351 } // namespace content 352 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698