OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_script_context.h" | 5 #include "content/renderer/service_worker/service_worker_script_context.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/child/thread_safe_sender.h" | 8 #include "content/child/thread_safe_sender.h" |
9 #include "content/child/webmessageportchannel_impl.h" | 9 #include "content/child/webmessageportchannel_impl.h" |
10 #include "content/common/service_worker/service_worker_messages.h" | 10 #include "content/common/service_worker/service_worker_messages.h" |
11 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 11 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
| 13 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
13 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" | 14 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" |
14 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
15 #include "third_party/WebKit/public/platform/WebURL.h" | 16 #include "third_party/WebKit/public/platform/WebURL.h" |
16 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 17 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
17 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 18 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 blink::WebServiceWorkerRequest webRequest; | 129 blink::WebServiceWorkerRequest webRequest; |
129 webRequest.setURL(blink::WebURL(request.url)); | 130 webRequest.setURL(blink::WebURL(request.url)); |
130 webRequest.setMethod(blink::WebString::fromUTF8(request.method)); | 131 webRequest.setMethod(blink::WebString::fromUTF8(request.method)); |
131 for (std::map<std::string, std::string>::const_iterator it = | 132 for (std::map<std::string, std::string>::const_iterator it = |
132 request.headers.begin(); | 133 request.headers.begin(); |
133 it != request.headers.end(); | 134 it != request.headers.end(); |
134 ++it) { | 135 ++it) { |
135 webRequest.setHeader(blink::WebString::fromUTF8(it->first), | 136 webRequest.setHeader(blink::WebString::fromUTF8(it->first), |
136 blink::WebString::fromUTF8(it->second)); | 137 blink::WebString::fromUTF8(it->second)); |
137 } | 138 } |
| 139 webRequest.setReferrer(blink::WebString::fromUTF8(request.referrer.spec()), |
| 140 blink::WebReferrerPolicyDefault); |
138 webRequest.setIsReload(request.is_reload); | 141 webRequest.setIsReload(request.is_reload); |
139 proxy_->dispatchFetchEvent(request_id, webRequest); | 142 proxy_->dispatchFetchEvent(request_id, webRequest); |
140 } | 143 } |
141 | 144 |
142 void ServiceWorkerScriptContext::OnSyncEvent(int request_id) { | 145 void ServiceWorkerScriptContext::OnSyncEvent(int request_id) { |
143 proxy_->dispatchSyncEvent(request_id); | 146 proxy_->dispatchSyncEvent(request_id); |
144 } | 147 } |
145 | 148 |
146 void ServiceWorkerScriptContext::OnPushEvent(int request_id, | 149 void ServiceWorkerScriptContext::OnPushEvent(int request_id, |
147 const std::string& data) { | 150 const std::string& data) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 info->clientIDs = client_ids; | 183 info->clientIDs = client_ids; |
181 callbacks->onSuccess(info.release()); | 184 callbacks->onSuccess(info.release()); |
182 pending_clients_callbacks_.Remove(request_id); | 185 pending_clients_callbacks_.Remove(request_id); |
183 } | 186 } |
184 | 187 |
185 int ServiceWorkerScriptContext::GetRoutingID() const { | 188 int ServiceWorkerScriptContext::GetRoutingID() const { |
186 return embedded_context_->embedded_worker_id(); | 189 return embedded_context_->embedded_worker_id(); |
187 } | 190 } |
188 | 191 |
189 } // namespace content | 192 } // namespace content |
OLD | NEW |