| 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/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 432 |
| 433 void ServiceWorkerProviderHost::NotifyControllerLost() { | 433 void ServiceWorkerProviderHost::NotifyControllerLost() { |
| 434 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); | 434 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); |
| 435 } | 435 } |
| 436 | 436 |
| 437 std::unique_ptr<ServiceWorkerRequestHandler> | 437 std::unique_ptr<ServiceWorkerRequestHandler> |
| 438 ServiceWorkerProviderHost::CreateRequestHandler( | 438 ServiceWorkerProviderHost::CreateRequestHandler( |
| 439 FetchRequestMode request_mode, | 439 FetchRequestMode request_mode, |
| 440 FetchCredentialsMode credentials_mode, | 440 FetchCredentialsMode credentials_mode, |
| 441 FetchRedirectMode redirect_mode, | 441 FetchRedirectMode redirect_mode, |
| 442 const std::string& integrity, |
| 442 ResourceType resource_type, | 443 ResourceType resource_type, |
| 443 RequestContextType request_context_type, | 444 RequestContextType request_context_type, |
| 444 RequestContextFrameType frame_type, | 445 RequestContextFrameType frame_type, |
| 445 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 446 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 446 scoped_refptr<ResourceRequestBodyImpl> body, | 447 scoped_refptr<ResourceRequestBodyImpl> body, |
| 447 bool skip_service_worker) { | 448 bool skip_service_worker) { |
| 448 // |skip_service_worker| is meant to apply to requests that could be handled | 449 // |skip_service_worker| is meant to apply to requests that could be handled |
| 449 // by a service worker, as opposed to requests for the service worker script | 450 // by a service worker, as opposed to requests for the service worker script |
| 450 // itself. So ignore it here for the service worker script and its imported | 451 // itself. So ignore it here for the service worker script and its imported |
| 451 // scripts. | 452 // scripts. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 466 context_, AsWeakPtr(), blob_storage_context, resource_type); | 467 context_, AsWeakPtr(), blob_storage_context, resource_type); |
| 467 } | 468 } |
| 468 if (IsHostToRunningServiceWorker()) { | 469 if (IsHostToRunningServiceWorker()) { |
| 469 return base::MakeUnique<ServiceWorkerContextRequestHandler>( | 470 return base::MakeUnique<ServiceWorkerContextRequestHandler>( |
| 470 context_, AsWeakPtr(), blob_storage_context, resource_type); | 471 context_, AsWeakPtr(), blob_storage_context, resource_type); |
| 471 } | 472 } |
| 472 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || | 473 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || |
| 473 controlling_version()) { | 474 controlling_version()) { |
| 474 return base::MakeUnique<ServiceWorkerControlleeRequestHandler>( | 475 return base::MakeUnique<ServiceWorkerControlleeRequestHandler>( |
| 475 context_, AsWeakPtr(), blob_storage_context, request_mode, | 476 context_, AsWeakPtr(), blob_storage_context, request_mode, |
| 476 credentials_mode, redirect_mode, resource_type, request_context_type, | 477 credentials_mode, redirect_mode, integrity, resource_type, |
| 477 frame_type, body); | 478 request_context_type, frame_type, body); |
| 478 } | 479 } |
| 479 return std::unique_ptr<ServiceWorkerRequestHandler>(); | 480 return std::unique_ptr<ServiceWorkerRequestHandler>(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 ServiceWorkerObjectInfo | 483 ServiceWorkerObjectInfo |
| 483 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( | 484 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( |
| 484 ServiceWorkerVersion* version) { | 485 ServiceWorkerVersion* version) { |
| 485 DCHECK(dispatcher_host_); | 486 DCHECK(dispatcher_host_); |
| 486 if (!context_ || !version) | 487 if (!context_ || !version) |
| 487 return ServiceWorkerObjectInfo(); | 488 return ServiceWorkerObjectInfo(); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 render_thread_id_, provider_id(), | 832 render_thread_id_, provider_id(), |
| 832 GetOrCreateServiceWorkerHandle( | 833 GetOrCreateServiceWorkerHandle( |
| 833 associated_registration_->active_version()), | 834 associated_registration_->active_version()), |
| 834 false /* shouldNotifyControllerChange */, | 835 false /* shouldNotifyControllerChange */, |
| 835 associated_registration_->active_version()->used_features())); | 836 associated_registration_->active_version()->used_features())); |
| 836 } | 837 } |
| 837 } | 838 } |
| 838 } | 839 } |
| 839 | 840 |
| 840 } // namespace content | 841 } // namespace content |
| OLD | NEW |