| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "content/browser/service_worker/embedded_worker_status.h" | 14 #include "content/browser/service_worker/embedded_worker_status.h" |
| 15 #include "content/browser/service_worker/service_worker_context_core.h" | 15 #include "content/browser/service_worker/service_worker_context_core.h" |
| 16 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 16 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| 17 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 17 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
| 18 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 18 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 19 #include "content/browser/service_worker/service_worker_handle.h" | 19 #include "content/browser/service_worker/service_worker_handle.h" |
| 20 #include "content/browser/service_worker/service_worker_registration_handle.h" | 20 #include "content/browser/service_worker/service_worker_registration_handle.h" |
| 21 #include "content/browser/service_worker/service_worker_version.h" | 21 #include "content/browser/service_worker/service_worker_version.h" |
| 22 #include "content/common/resource_request_body_impl.h" | |
| 23 #include "content/common/service_worker/service_worker_messages.h" | 22 #include "content/common/service_worker/service_worker_messages.h" |
| 24 #include "content/common/service_worker/service_worker_types.h" | 23 #include "content/common/service_worker/service_worker_types.h" |
| 25 #include "content/common/service_worker/service_worker_utils.h" | 24 #include "content/common/service_worker/service_worker_utils.h" |
| 26 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
| 27 #include "content/public/common/browser_side_navigation_policy.h" | 26 #include "content/public/common/browser_side_navigation_policy.h" |
| 28 #include "content/public/common/child_process_host.h" | 27 #include "content/public/common/child_process_host.h" |
| 29 #include "content/public/common/content_client.h" | 28 #include "content/public/common/content_client.h" |
| 30 #include "content/public/common/content_features.h" | 29 #include "content/public/common/content_features.h" |
| 31 #include "content/public/common/origin_util.h" | 30 #include "content/public/common/origin_util.h" |
| 31 #include "content/public/common/resource_request_body.h" |
| 32 #include "mojo/public/cpp/bindings/strong_associated_binding.h" | 32 #include "mojo/public/cpp/bindings/strong_associated_binding.h" |
| 33 #include "net/base/url_util.h" | 33 #include "net/base/url_util.h" |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 // PlzNavigate | 39 // PlzNavigate |
| 40 // Next ServiceWorkerProviderHost ID for navigations, starts at -2 and keeps | 40 // Next ServiceWorkerProviderHost ID for navigations, starts at -2 and keeps |
| 41 // going down. | 41 // going down. |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ResourceType resource_type, | 442 ResourceType resource_type, |
| 443 RequestContextType request_context_type, | 443 RequestContextType request_context_type, |
| 444 RequestContextFrameType frame_type, | 444 RequestContextFrameType frame_type, |
| 445 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 445 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 446 scoped_refptr<ResourceRequestBodyImpl> body, | 446 scoped_refptr<ResourceRequestBody> body, |
| 447 bool skip_service_worker) { | 447 bool skip_service_worker) { |
| 448 // |skip_service_worker| is meant to apply to requests that could be handled | 448 // |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 | 449 // 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 | 450 // itself. So ignore it here for the service worker script and its imported |
| 451 // scripts. | 451 // scripts. |
| 452 // TODO(falken): Really it should be treated as an error to set | 452 // TODO(falken): Really it should be treated as an error to set |
| 453 // |skip_service_worker| for requests to start the service worker, but it's | 453 // |skip_service_worker| for requests to start the service worker, but it's |
| 454 // difficult to fix that renderer-side, since we don't know whether a request | 454 // difficult to fix that renderer-side, since we don't know whether a request |
| 455 // is for a service worker without access to IsHostToRunningServiceWorker() as | 455 // is for a service worker without access to IsHostToRunningServiceWorker() as |
| 456 // that state is stored browser-side. | 456 // that state is stored browser-side. |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 render_thread_id_, provider_id(), | 831 render_thread_id_, provider_id(), |
| 832 GetOrCreateServiceWorkerHandle( | 832 GetOrCreateServiceWorkerHandle( |
| 833 associated_registration_->active_version()), | 833 associated_registration_->active_version()), |
| 834 false /* shouldNotifyControllerChange */, | 834 false /* shouldNotifyControllerChange */, |
| 835 associated_registration_->active_version()->used_features())); | 835 associated_registration_->active_version()->used_features())); |
| 836 } | 836 } |
| 837 } | 837 } |
| 838 } | 838 } |
| 839 | 839 |
| 840 } // namespace content | 840 } // namespace content |
| OLD | NEW |