OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 RequestContextFrameType frame_type, | 334 RequestContextFrameType frame_type, |
335 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 335 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
336 scoped_refptr<ResourceRequestBodyImpl> body) { | 336 scoped_refptr<ResourceRequestBodyImpl> body) { |
337 if (IsHostToRunningServiceWorker()) { | 337 if (IsHostToRunningServiceWorker()) { |
338 return std::unique_ptr<ServiceWorkerRequestHandler>( | 338 return std::unique_ptr<ServiceWorkerRequestHandler>( |
339 new ServiceWorkerContextRequestHandler( | 339 new ServiceWorkerContextRequestHandler( |
340 context_, AsWeakPtr(), blob_storage_context, resource_type)); | 340 context_, AsWeakPtr(), blob_storage_context, resource_type)); |
341 } | 341 } |
342 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || | 342 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || |
343 controlling_version()) { | 343 controlling_version()) { |
| 344 // |dispatcher_host_| may be null in some unittests. |
344 return std::unique_ptr<ServiceWorkerRequestHandler>( | 345 return std::unique_ptr<ServiceWorkerRequestHandler>( |
345 new ServiceWorkerControlleeRequestHandler( | 346 new ServiceWorkerControlleeRequestHandler( |
346 context_, AsWeakPtr(), blob_storage_context, request_mode, | 347 context_, AsWeakPtr(), blob_storage_context, request_mode, |
347 credentials_mode, redirect_mode, resource_type, | 348 credentials_mode, redirect_mode, resource_type, |
348 request_context_type, frame_type, body)); | 349 request_context_type, frame_type, body, |
| 350 dispatcher_host_ ? dispatcher_host_->url_loader_factory_getter() |
| 351 : MojoURLLoaderFactoryGetter())); |
349 } | 352 } |
350 return std::unique_ptr<ServiceWorkerRequestHandler>(); | 353 return std::unique_ptr<ServiceWorkerRequestHandler>(); |
351 } | 354 } |
352 | 355 |
353 ServiceWorkerObjectInfo | 356 ServiceWorkerObjectInfo |
354 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( | 357 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( |
355 ServiceWorkerVersion* version) { | 358 ServiceWorkerVersion* version) { |
356 DCHECK(dispatcher_host_); | 359 DCHECK(dispatcher_host_); |
357 if (!context_ || !version) | 360 if (!context_ || !version) |
358 return ServiceWorkerObjectInfo(); | 361 return ServiceWorkerObjectInfo(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 677 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
675 render_thread_id_, provider_id(), | 678 render_thread_id_, provider_id(), |
676 GetOrCreateServiceWorkerHandle( | 679 GetOrCreateServiceWorkerHandle( |
677 associated_registration_->active_version()), | 680 associated_registration_->active_version()), |
678 false /* shouldNotifyControllerChange */)); | 681 false /* shouldNotifyControllerChange */)); |
679 } | 682 } |
680 } | 683 } |
681 } | 684 } |
682 | 685 |
683 } // namespace content | 686 } // namespace content |
OLD | NEW |