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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 567 |
568 blink::WebServiceWorkerNetworkProvider* | 568 blink::WebServiceWorkerNetworkProvider* |
569 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( | 569 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( |
570 blink::WebDataSource* data_source) { | 570 blink::WebDataSource* data_source) { |
571 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 571 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
572 | 572 |
573 // Create a content::ServiceWorkerNetworkProvider for this data source so | 573 // Create a content::ServiceWorkerNetworkProvider for this data source so |
574 // we can observe its requests. | 574 // we can observe its requests. |
575 std::unique_ptr<ServiceWorkerNetworkProvider> provider( | 575 std::unique_ptr<ServiceWorkerNetworkProvider> provider( |
576 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, | 576 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, |
577 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER)); | 577 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, |
| 578 true /* is_parent_frame_secure */)); |
578 provider_context_ = provider->context(); | 579 provider_context_ = provider->context(); |
579 | 580 |
580 // Tell the network provider about which version to load. | 581 // Tell the network provider about which version to load. |
581 provider->SetServiceWorkerVersionId(service_worker_version_id_); | 582 provider->SetServiceWorkerVersionId(service_worker_version_id_); |
582 | 583 |
583 // The provider is kept around for the lifetime of the DataSource | 584 // The provider is kept around for the lifetime of the DataSource |
584 // and ownership is transferred to the DataSource. | 585 // and ownership is transferred to the DataSource. |
585 DataSourceExtraData* extra_data = new DataSourceExtraData(); | 586 DataSourceExtraData* extra_data = new DataSourceExtraData(); |
586 data_source->setExtraData(extra_data); | 587 data_source->setExtraData(extra_data); |
587 ServiceWorkerNetworkProvider::AttachToDocumentState(extra_data, | 588 ServiceWorkerNetworkProvider::AttachToDocumentState(extra_data, |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 } | 1018 } |
1018 | 1019 |
1019 base::WeakPtr<ServiceWorkerContextClient> | 1020 base::WeakPtr<ServiceWorkerContextClient> |
1020 ServiceWorkerContextClient::GetWeakPtr() { | 1021 ServiceWorkerContextClient::GetWeakPtr() { |
1021 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1022 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1022 DCHECK(context_); | 1023 DCHECK(context_); |
1023 return context_->weak_factory.GetWeakPtr(); | 1024 return context_->weak_factory.GetWeakPtr(); |
1024 } | 1025 } |
1025 | 1026 |
1026 } // namespace content | 1027 } // namespace content |
OLD | NEW |