| 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/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "webkit/common/resource_type.h" | 14 #include "webkit/common/resource_type.h" |
| 15 | 15 |
| 16 namespace IPC { | 16 namespace IPC { |
| 17 class Sender; | 17 class Sender; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace webkit_blob { |
| 21 class BlobStorageContext; |
| 22 } |
| 23 |
| 20 namespace content { | 24 namespace content { |
| 21 | 25 |
| 22 class ServiceWorkerContextCore; | 26 class ServiceWorkerContextCore; |
| 23 class ServiceWorkerDispatcherHost; | 27 class ServiceWorkerDispatcherHost; |
| 24 class ServiceWorkerRequestHandler; | 28 class ServiceWorkerRequestHandler; |
| 25 class ServiceWorkerVersion; | 29 class ServiceWorkerVersion; |
| 26 | 30 |
| 27 // This class is the browser-process representation of a serice worker | 31 // This class is the browser-process representation of a serice worker |
| 28 // provider. There is a provider per document and the lifetime of this | 32 // provider. There is a provider per document and the lifetime of this |
| 29 // object is tied to the lifetime of its document in the renderer process. | 33 // object is tied to the lifetime of its document in the renderer process. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void SetActiveVersion(ServiceWorkerVersion* version); | 79 void SetActiveVersion(ServiceWorkerVersion* version); |
| 76 void SetPendingVersion(ServiceWorkerVersion* version); | 80 void SetPendingVersion(ServiceWorkerVersion* version); |
| 77 | 81 |
| 78 // Returns false if the version is not in the expected STARTING in our | 82 // Returns false if the version is not in the expected STARTING in our |
| 79 // our process state. That would be indicative of a bad IPC message. | 83 // our process state. That would be indicative of a bad IPC message. |
| 80 bool SetHostedVersionId(int64 versions_id); | 84 bool SetHostedVersionId(int64 versions_id); |
| 81 | 85 |
| 82 // Returns a handler for a request, the handler may return NULL if | 86 // Returns a handler for a request, the handler may return NULL if |
| 83 // the request doesn't require special handling. | 87 // the request doesn't require special handling. |
| 84 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( | 88 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( |
| 85 ResourceType::Type resource_type); | 89 ResourceType::Type resource_type, |
| 90 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context); |
| 86 | 91 |
| 87 // Dispatches message event to the document. | 92 // Dispatches message event to the document. |
| 88 void PostMessage(const base::string16& message, | 93 void PostMessage(const base::string16& message, |
| 89 const std::vector<int>& sent_message_port_ids); | 94 const std::vector<int>& sent_message_port_ids); |
| 90 | 95 |
| 91 private: | 96 private: |
| 92 const int process_id_; | 97 const int process_id_; |
| 93 const int provider_id_; | 98 const int provider_id_; |
| 94 GURL document_url_; | 99 GURL document_url_; |
| 95 scoped_refptr<ServiceWorkerVersion> active_version_; | 100 scoped_refptr<ServiceWorkerVersion> active_version_; |
| 96 scoped_refptr<ServiceWorkerVersion> pending_version_; | 101 scoped_refptr<ServiceWorkerVersion> pending_version_; |
| 97 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; | 102 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
| 98 base::WeakPtr<ServiceWorkerContextCore> context_; | 103 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 99 ServiceWorkerDispatcherHost* dispatcher_host_; | 104 ServiceWorkerDispatcherHost* dispatcher_host_; |
| 100 | 105 |
| 101 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 106 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 } // namespace content | 109 } // namespace content |
| 105 | 110 |
| 106 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 111 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| OLD | NEW |