| 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/browser/service_worker/service_worker_registration.h" | 13 #include "content/browser/service_worker/service_worker_registration.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/common/service_worker/service_worker_types.h" | 15 #include "content/common/service_worker/service_worker_types.h" |
| 16 #include "content/public/common/resource_type.h" | 16 #include "content/public/common/resource_type.h" |
| 17 | 17 |
| 18 namespace IPC { | 18 namespace IPC { |
| 19 class Sender; | 19 class Sender; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace storage { | 22 namespace storage { |
| 23 class BlobStorageContext; | 23 class BlobStorageContext; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 enum FetchRequestMode; |
| 28 class ResourceRequestBody; | 29 class ResourceRequestBody; |
| 29 class ServiceWorkerContextCore; | 30 class ServiceWorkerContextCore; |
| 30 class ServiceWorkerDispatcherHost; | 31 class ServiceWorkerDispatcherHost; |
| 31 class ServiceWorkerRequestHandler; | 32 class ServiceWorkerRequestHandler; |
| 32 class ServiceWorkerVersion; | 33 class ServiceWorkerVersion; |
| 33 | 34 |
| 34 // This class is the browser-process representation of a service worker | 35 // This class is the browser-process representation of a service worker |
| 35 // provider. There is a provider per document and the lifetime of this | 36 // provider. There is a provider per document and the lifetime of this |
| 36 // object is tied to the lifetime of its document in the renderer process. | 37 // object is tied to the lifetime of its document in the renderer process. |
| 37 // This class holds service worker state that is scoped to an individual | 38 // This class holds service worker state that is scoped to an individual |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Clears the associated registration and stop listening to it. | 88 // Clears the associated registration and stop listening to it. |
| 88 void DisassociateRegistration(); | 89 void DisassociateRegistration(); |
| 89 | 90 |
| 90 // Returns false if the version is not in the expected STARTING in our | 91 // Returns false if the version is not in the expected STARTING in our |
| 91 // process state. That would be indicative of a bad IPC message. | 92 // process state. That would be indicative of a bad IPC message. |
| 92 bool SetHostedVersionId(int64 versions_id); | 93 bool SetHostedVersionId(int64 versions_id); |
| 93 | 94 |
| 94 // Returns a handler for a request, the handler may return NULL if | 95 // Returns a handler for a request, the handler may return NULL if |
| 95 // the request doesn't require special handling. | 96 // the request doesn't require special handling. |
| 96 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( | 97 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( |
| 98 FetchRequestMode request_mode, |
| 97 ResourceType resource_type, | 99 ResourceType resource_type, |
| 98 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 100 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 99 scoped_refptr<ResourceRequestBody> body); | 101 scoped_refptr<ResourceRequestBody> body); |
| 100 | 102 |
| 101 // Returns true if |registration| can be associated with this provider. | 103 // Returns true if |registration| can be associated with this provider. |
| 102 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); | 104 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); |
| 103 | 105 |
| 104 // For use by the ServiceWorkerControlleeRequestHandler to disallow | 106 // For use by the ServiceWorkerControlleeRequestHandler to disallow |
| 105 // new registration association while a navigation is occurring and | 107 // new registration association while a navigation is occurring and |
| 106 // an existing registration is being looked for. | 108 // an existing registration is being looked for. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 base::WeakPtr<ServiceWorkerContextCore> context_; | 156 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 155 ServiceWorkerDispatcherHost* dispatcher_host_; | 157 ServiceWorkerDispatcherHost* dispatcher_host_; |
| 156 bool allow_association_; | 158 bool allow_association_; |
| 157 | 159 |
| 158 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 160 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
| 159 }; | 161 }; |
| 160 | 162 |
| 161 } // namespace content | 163 } // namespace content |
| 162 | 164 |
| 163 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 165 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| OLD | NEW |