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 <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 // Blink calls this method for each request starting with the main script, | 94 // Blink calls this method for each request starting with the main script, |
95 // we tag them with the provider id. | 95 // we tag them with the provider id. |
96 void WillSendRequest(blink::WebURLRequest& request) override { | 96 void WillSendRequest(blink::WebURLRequest& request) override { |
97 std::unique_ptr<RequestExtraData> extra_data(new RequestExtraData); | 97 std::unique_ptr<RequestExtraData> extra_data(new RequestExtraData); |
98 extra_data->set_service_worker_provider_id(provider_->provider_id()); | 98 extra_data->set_service_worker_provider_id(provider_->provider_id()); |
99 extra_data->set_originated_from_service_worker(true); | 99 extra_data->set_originated_from_service_worker(true); |
100 // Service workers are only available in secure contexts, so all requests | 100 // Service workers are only available in secure contexts, so all requests |
101 // are initiated in a secure context. | 101 // are initiated in a secure context. |
102 extra_data->set_initiated_in_secure_context(true); | 102 extra_data->set_initiated_in_secure_context(true); |
103 extra_data->set_url_loader_factory_override( | |
104 provider_->script_loader_factory()); | |
105 request.SetExtraData(extra_data.release()); | 103 request.SetExtraData(extra_data.release()); |
106 } | 104 } |
107 | 105 |
108 int GetProviderID() const override { return provider_->provider_id(); } | 106 int GetProviderID() const override { return provider_->provider_id(); } |
109 | 107 |
110 private: | 108 private: |
111 std::unique_ptr<ServiceWorkerNetworkProvider> provider_; | 109 std::unique_ptr<ServiceWorkerNetworkProvider> provider_; |
112 }; | 110 }; |
113 | 111 |
114 class StreamHandleListener | 112 class StreamHandleListener |
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 } | 1688 } |
1691 | 1689 |
1692 base::WeakPtr<ServiceWorkerContextClient> | 1690 base::WeakPtr<ServiceWorkerContextClient> |
1693 ServiceWorkerContextClient::GetWeakPtr() { | 1691 ServiceWorkerContextClient::GetWeakPtr() { |
1694 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); | 1692 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); |
1695 DCHECK(context_); | 1693 DCHECK(context_); |
1696 return context_->weak_factory.GetWeakPtr(); | 1694 return context_->weak_factory.GetWeakPtr(); |
1697 } | 1695 } |
1698 | 1696 |
1699 } // namespace content | 1697 } // namespace content |
OLD | NEW |