OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 572 |
573 blink::WebServiceWorkerNetworkProvider* | 573 blink::WebServiceWorkerNetworkProvider* |
574 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( | 574 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( |
575 blink::WebDataSource* data_source) { | 575 blink::WebDataSource* data_source) { |
576 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 576 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
577 | 577 |
578 // Create a content::ServiceWorkerNetworkProvider for this data source so | 578 // Create a content::ServiceWorkerNetworkProvider for this data source so |
579 // we can observe its requests. | 579 // we can observe its requests. |
580 std::unique_ptr<ServiceWorkerNetworkProvider> provider( | 580 std::unique_ptr<ServiceWorkerNetworkProvider> provider( |
581 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, | 581 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, |
582 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER)); | 582 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, |
| 583 true /* is_parent_frame_secure */)); |
583 provider_context_ = provider->context(); | 584 provider_context_ = provider->context(); |
584 | 585 |
585 // Tell the network provider about which version to load. | 586 // Tell the network provider about which version to load. |
586 provider->SetServiceWorkerVersionId(service_worker_version_id_); | 587 provider->SetServiceWorkerVersionId(service_worker_version_id_); |
587 | 588 |
588 // The provider is kept around for the lifetime of the DataSource | 589 // The provider is kept around for the lifetime of the DataSource |
589 // and ownership is transferred to the DataSource. | 590 // and ownership is transferred to the DataSource. |
590 DataSourceExtraData* extra_data = new DataSourceExtraData(); | 591 DataSourceExtraData* extra_data = new DataSourceExtraData(); |
591 data_source->setExtraData(extra_data); | 592 data_source->setExtraData(extra_data); |
592 ServiceWorkerNetworkProvider::AttachToDocumentState(extra_data, | 593 ServiceWorkerNetworkProvider::AttachToDocumentState(extra_data, |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1023 } |
1023 | 1024 |
1024 base::WeakPtr<ServiceWorkerContextClient> | 1025 base::WeakPtr<ServiceWorkerContextClient> |
1025 ServiceWorkerContextClient::GetWeakPtr() { | 1026 ServiceWorkerContextClient::GetWeakPtr() { |
1026 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1027 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1027 DCHECK(context_); | 1028 DCHECK(context_); |
1028 return context_->weak_factory.GetWeakPtr(); | 1029 return context_->weak_factory.GetWeakPtr(); |
1029 } | 1030 } |
1030 | 1031 |
1031 } // namespace content | 1032 } // namespace content |
OLD | NEW |