| 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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "content/browser/message_port_message_filter.h" | 8 #include "content/browser/message_port_message_filter.h" |
| 9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
| 10 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 10 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 if (dispatcher_host_) { | 141 if (dispatcher_host_) { |
| 142 dispatcher_host_->Send(new ServiceWorkerMsg_DisassociateRegistration( | 142 dispatcher_host_->Send(new ServiceWorkerMsg_DisassociateRegistration( |
| 143 kDocumentMainThreadId, provider_id())); | 143 kDocumentMainThreadId, provider_id())); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 scoped_ptr<ServiceWorkerRequestHandler> | 147 scoped_ptr<ServiceWorkerRequestHandler> |
| 148 ServiceWorkerProviderHost::CreateRequestHandler( | 148 ServiceWorkerProviderHost::CreateRequestHandler( |
| 149 FetchRequestMode request_mode, | 149 FetchRequestMode request_mode, |
| 150 FetchCredentialsMode credentials_mode, |
| 150 ResourceType resource_type, | 151 ResourceType resource_type, |
| 151 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 152 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 152 scoped_refptr<ResourceRequestBody> body) { | 153 scoped_refptr<ResourceRequestBody> body) { |
| 153 if (IsHostToRunningServiceWorker()) { | 154 if (IsHostToRunningServiceWorker()) { |
| 154 return scoped_ptr<ServiceWorkerRequestHandler>( | 155 return scoped_ptr<ServiceWorkerRequestHandler>( |
| 155 new ServiceWorkerContextRequestHandler( | 156 new ServiceWorkerContextRequestHandler( |
| 156 context_, AsWeakPtr(), blob_storage_context, resource_type)); | 157 context_, AsWeakPtr(), blob_storage_context, resource_type)); |
| 157 } | 158 } |
| 158 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || | 159 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || |
| 159 controlling_version()) { | 160 controlling_version()) { |
| 160 return scoped_ptr<ServiceWorkerRequestHandler>( | 161 return scoped_ptr<ServiceWorkerRequestHandler>( |
| 161 new ServiceWorkerControlleeRequestHandler(context_, | 162 new ServiceWorkerControlleeRequestHandler(context_, |
| 162 AsWeakPtr(), | 163 AsWeakPtr(), |
| 163 blob_storage_context, | 164 blob_storage_context, |
| 164 request_mode, | 165 request_mode, |
| 166 credentials_mode, |
| 165 resource_type, | 167 resource_type, |
| 166 body)); | 168 body)); |
| 167 } | 169 } |
| 168 return scoped_ptr<ServiceWorkerRequestHandler>(); | 170 return scoped_ptr<ServiceWorkerRequestHandler>(); |
| 169 } | 171 } |
| 170 | 172 |
| 171 bool ServiceWorkerProviderHost::CanAssociateRegistration( | 173 bool ServiceWorkerProviderHost::CanAssociateRegistration( |
| 172 ServiceWorkerRegistration* registration) { | 174 ServiceWorkerRegistration* registration) { |
| 173 if (!context_) | 175 if (!context_) |
| 174 return false; | 176 return false; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 context_->process_manager()->RemoveProcessReferenceFromPattern( | 236 context_->process_manager()->RemoveProcessReferenceFromPattern( |
| 235 pattern, process_id_); | 237 pattern, process_id_); |
| 236 } | 238 } |
| 237 } | 239 } |
| 238 | 240 |
| 239 bool ServiceWorkerProviderHost::IsContextAlive() { | 241 bool ServiceWorkerProviderHost::IsContextAlive() { |
| 240 return context_ != NULL; | 242 return context_ != NULL; |
| 241 } | 243 } |
| 242 | 244 |
| 243 } // namespace content | 245 } // namespace content |
| OLD | NEW |