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 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Returns a handler for a request, the handler may return NULL if | 92 // Returns a handler for a request, the handler may return NULL if |
93 // the request doesn't require special handling. | 93 // the request doesn't require special handling. |
94 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( | 94 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( |
95 ResourceType resource_type, | 95 ResourceType resource_type, |
96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
97 scoped_refptr<ResourceRequestBody> body); | 97 scoped_refptr<ResourceRequestBody> body); |
98 | 98 |
99 // Returns true if |registration| can be associated with this provider. | 99 // Returns true if |registration| can be associated with this provider. |
100 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); | 100 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); |
101 | 101 |
| 102 // For use by the ServiceWorkerControlleeRequestHandler to disallow |
| 103 // registration association while a navigation is occurring. |
| 104 void SetAllowAssociation(bool allow) { allow_association_ = allow; } |
| 105 |
102 // Returns true if the context referred to by this host (i.e. |context_|) is | 106 // Returns true if the context referred to by this host (i.e. |context_|) is |
103 // still alive. | 107 // still alive. |
104 bool IsContextAlive(); | 108 bool IsContextAlive(); |
105 | 109 |
106 // Dispatches message event to the document. | 110 // Dispatches message event to the document. |
107 void PostMessage(const base::string16& message, | 111 void PostMessage(const base::string16& message, |
108 const std::vector<int>& sent_message_port_ids); | 112 const std::vector<int>& sent_message_port_ids); |
109 | 113 |
110 private: | 114 private: |
111 friend class ServiceWorkerProviderHostTest; | 115 friend class ServiceWorkerProviderHostTest; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 148 |
145 scoped_refptr<ServiceWorkerRegistration> associated_registration_; | 149 scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
146 | 150 |
147 scoped_refptr<ServiceWorkerVersion> controlling_version_; | 151 scoped_refptr<ServiceWorkerVersion> controlling_version_; |
148 scoped_refptr<ServiceWorkerVersion> active_version_; | 152 scoped_refptr<ServiceWorkerVersion> active_version_; |
149 scoped_refptr<ServiceWorkerVersion> waiting_version_; | 153 scoped_refptr<ServiceWorkerVersion> waiting_version_; |
150 scoped_refptr<ServiceWorkerVersion> installing_version_; | 154 scoped_refptr<ServiceWorkerVersion> installing_version_; |
151 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; | 155 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
152 base::WeakPtr<ServiceWorkerContextCore> context_; | 156 base::WeakPtr<ServiceWorkerContextCore> context_; |
153 ServiceWorkerDispatcherHost* dispatcher_host_; | 157 ServiceWorkerDispatcherHost* dispatcher_host_; |
| 158 bool allow_association_; |
154 | 159 |
155 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 160 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
156 }; | 161 }; |
157 | 162 |
158 } // namespace content | 163 } // namespace content |
159 | 164 |
160 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 165 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |