| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 593 |
| 594 void ServiceWorkerProviderHost::NotifyControllerLost() { | 594 void ServiceWorkerProviderHost::NotifyControllerLost() { |
| 595 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); | 595 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); |
| 596 } | 596 } |
| 597 | 597 |
| 598 std::unique_ptr<ServiceWorkerRequestHandler> | 598 std::unique_ptr<ServiceWorkerRequestHandler> |
| 599 ServiceWorkerProviderHost::CreateRequestHandler( | 599 ServiceWorkerProviderHost::CreateRequestHandler( |
| 600 FetchRequestMode request_mode, | 600 FetchRequestMode request_mode, |
| 601 FetchCredentialsMode credentials_mode, | 601 FetchCredentialsMode credentials_mode, |
| 602 FetchRedirectMode redirect_mode, | 602 FetchRedirectMode redirect_mode, |
| 603 const std::string& integrity, |
| 603 ResourceType resource_type, | 604 ResourceType resource_type, |
| 604 RequestContextType request_context_type, | 605 RequestContextType request_context_type, |
| 605 RequestContextFrameType frame_type, | 606 RequestContextFrameType frame_type, |
| 606 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 607 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 607 scoped_refptr<ResourceRequestBody> body, | 608 scoped_refptr<ResourceRequestBody> body, |
| 608 bool skip_service_worker) { | 609 bool skip_service_worker) { |
| 609 // |skip_service_worker| is meant to apply to requests that could be handled | 610 // |skip_service_worker| is meant to apply to requests that could be handled |
| 610 // by a service worker, as opposed to requests for the service worker script | 611 // by a service worker, as opposed to requests for the service worker script |
| 611 // itself. So ignore it here for the service worker script and its imported | 612 // itself. So ignore it here for the service worker script and its imported |
| 612 // scripts. | 613 // scripts. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 627 context_, AsWeakPtr(), blob_storage_context, resource_type); | 628 context_, AsWeakPtr(), blob_storage_context, resource_type); |
| 628 } | 629 } |
| 629 if (IsHostToRunningServiceWorker()) { | 630 if (IsHostToRunningServiceWorker()) { |
| 630 return base::MakeUnique<ServiceWorkerContextRequestHandler>( | 631 return base::MakeUnique<ServiceWorkerContextRequestHandler>( |
| 631 context_, AsWeakPtr(), blob_storage_context, resource_type); | 632 context_, AsWeakPtr(), blob_storage_context, resource_type); |
| 632 } | 633 } |
| 633 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || | 634 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || |
| 634 controlling_version()) { | 635 controlling_version()) { |
| 635 return base::MakeUnique<ServiceWorkerControlleeRequestHandler>( | 636 return base::MakeUnique<ServiceWorkerControlleeRequestHandler>( |
| 636 context_, AsWeakPtr(), blob_storage_context, request_mode, | 637 context_, AsWeakPtr(), blob_storage_context, request_mode, |
| 637 credentials_mode, redirect_mode, resource_type, request_context_type, | 638 credentials_mode, redirect_mode, integrity, resource_type, |
| 638 frame_type, body); | 639 request_context_type, frame_type, body); |
| 639 } | 640 } |
| 640 return std::unique_ptr<ServiceWorkerRequestHandler>(); | 641 return std::unique_ptr<ServiceWorkerRequestHandler>(); |
| 641 } | 642 } |
| 642 | 643 |
| 643 ServiceWorkerObjectInfo | 644 ServiceWorkerObjectInfo |
| 644 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( | 645 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( |
| 645 ServiceWorkerVersion* version) { | 646 ServiceWorkerVersion* version) { |
| 646 DCHECK(dispatcher_host_); | 647 DCHECK(dispatcher_host_); |
| 647 if (!context_ || !version) | 648 if (!context_ || !version) |
| 648 return ServiceWorkerObjectInfo(); | 649 return ServiceWorkerObjectInfo(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 render_thread_id_, provider_id(), | 995 render_thread_id_, provider_id(), |
| 995 GetOrCreateServiceWorkerHandle( | 996 GetOrCreateServiceWorkerHandle( |
| 996 associated_registration_->active_version()), | 997 associated_registration_->active_version()), |
| 997 false /* shouldNotifyControllerChange */, | 998 false /* shouldNotifyControllerChange */, |
| 998 associated_registration_->active_version()->used_features())); | 999 associated_registration_->active_version()->used_features())); |
| 999 } | 1000 } |
| 1000 } | 1001 } |
| 1001 } | 1002 } |
| 1002 | 1003 |
| 1003 } // namespace content | 1004 } // namespace content |
| OLD | NEW |