| 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/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 | 326 |
| 327 void ServiceWorkerProviderHost::NotifyControllerLost() { | 327 void ServiceWorkerProviderHost::NotifyControllerLost() { |
| 328 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); | 328 SetControllerVersionAttribute(nullptr, true /* notify_controllerchange */); |
| 329 } | 329 } |
| 330 | 330 |
| 331 scoped_ptr<ServiceWorkerRequestHandler> | 331 scoped_ptr<ServiceWorkerRequestHandler> |
| 332 ServiceWorkerProviderHost::CreateRequestHandler( | 332 ServiceWorkerProviderHost::CreateRequestHandler( |
| 333 FetchRequestMode request_mode, | 333 FetchRequestMode request_mode, |
| 334 FetchCredentialsMode credentials_mode, | 334 FetchCredentialsMode credentials_mode, |
| 335 FetchRedirectMode redirect_mode, |
| 335 ResourceType resource_type, | 336 ResourceType resource_type, |
| 336 RequestContextType request_context_type, | 337 RequestContextType request_context_type, |
| 337 RequestContextFrameType frame_type, | 338 RequestContextFrameType frame_type, |
| 338 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 339 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 339 scoped_refptr<ResourceRequestBody> body) { | 340 scoped_refptr<ResourceRequestBody> body) { |
| 340 if (IsHostToRunningServiceWorker()) { | 341 if (IsHostToRunningServiceWorker()) { |
| 341 return scoped_ptr<ServiceWorkerRequestHandler>( | 342 return scoped_ptr<ServiceWorkerRequestHandler>( |
| 342 new ServiceWorkerContextRequestHandler( | 343 new ServiceWorkerContextRequestHandler( |
| 343 context_, AsWeakPtr(), blob_storage_context, resource_type)); | 344 context_, AsWeakPtr(), blob_storage_context, resource_type)); |
| 344 } | 345 } |
| 345 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || | 346 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || |
| 346 controlling_version()) { | 347 controlling_version()) { |
| 347 return scoped_ptr<ServiceWorkerRequestHandler>( | 348 return scoped_ptr<ServiceWorkerRequestHandler>( |
| 348 new ServiceWorkerControlleeRequestHandler(context_, | 349 new ServiceWorkerControlleeRequestHandler( |
| 349 AsWeakPtr(), | 350 context_, AsWeakPtr(), blob_storage_context, request_mode, |
| 350 blob_storage_context, | 351 credentials_mode, redirect_mode, resource_type, |
| 351 request_mode, | 352 request_context_type, frame_type, body)); |
| 352 credentials_mode, | |
| 353 resource_type, | |
| 354 request_context_type, | |
| 355 frame_type, | |
| 356 body)); | |
| 357 } | 353 } |
| 358 return scoped_ptr<ServiceWorkerRequestHandler>(); | 354 return scoped_ptr<ServiceWorkerRequestHandler>(); |
| 359 } | 355 } |
| 360 | 356 |
| 361 ServiceWorkerObjectInfo | 357 ServiceWorkerObjectInfo |
| 362 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( | 358 ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( |
| 363 ServiceWorkerVersion* version) { | 359 ServiceWorkerVersion* version) { |
| 364 DCHECK(dispatcher_host_); | 360 DCHECK(dispatcher_host_); |
| 365 if (!context_ || !version) | 361 if (!context_ || !version) |
| 366 return ServiceWorkerObjectInfo(); | 362 return ServiceWorkerObjectInfo(); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 return context_ != NULL; | 677 return context_ != NULL; |
| 682 } | 678 } |
| 683 | 679 |
| 684 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 680 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
| 685 DCHECK(dispatcher_host_); | 681 DCHECK(dispatcher_host_); |
| 686 DCHECK(IsReadyToSendMessages()); | 682 DCHECK(IsReadyToSendMessages()); |
| 687 dispatcher_host_->Send(message); | 683 dispatcher_host_->Send(message); |
| 688 } | 684 } |
| 689 | 685 |
| 690 } // namespace content | 686 } // namespace content |
| OLD | NEW |