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. | |
345 return std::unique_ptr<ServiceWorkerRequestHandler>( | 344 return std::unique_ptr<ServiceWorkerRequestHandler>( |
346 new ServiceWorkerControlleeRequestHandler( | 345 new ServiceWorkerControlleeRequestHandler( |
347 context_, AsWeakPtr(), blob_storage_context, request_mode, | 346 context_, AsWeakPtr(), blob_storage_context, request_mode, |
348 credentials_mode, redirect_mode, resource_type, | 347 credentials_mode, redirect_mode, resource_type, |
349 request_context_type, frame_type, body, | 348 request_context_type, frame_type, body)); |
350 dispatcher_host_ ? dispatcher_host_->url_loader_factory_getter() | |
351 : MojoURLLoaderFactoryGetter())); | |
352 } | 349 } |
353 return std::unique_ptr<ServiceWorkerRequestHandler>(); | 350 return std::unique_ptr<ServiceWorkerRequestHandler>(); |
354 } | 351 } |
355 | 352 |
356 ServiceWorkerObjectInfo | 353 ServiceWorkerObjectInfo |
357 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( | 354 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( |
358 ServiceWorkerVersion* version) { | 355 ServiceWorkerVersion* version) { |
359 DCHECK(dispatcher_host_); | 356 DCHECK(dispatcher_host_); |
360 if (!context_ || !version) | 357 if (!context_ || !version) |
361 return ServiceWorkerObjectInfo(); | 358 return ServiceWorkerObjectInfo(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 674 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
678 render_thread_id_, provider_id(), | 675 render_thread_id_, provider_id(), |
679 GetOrCreateServiceWorkerHandle( | 676 GetOrCreateServiceWorkerHandle( |
680 associated_registration_->active_version()), | 677 associated_registration_->active_version()), |
681 false /* shouldNotifyControllerChange */)); | 678 false /* shouldNotifyControllerChange */)); |
682 } | 679 } |
683 } | 680 } |
684 } | 681 } |
685 | 682 |
686 } // namespace content | 683 } // namespace content |
OLD | NEW |