Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 615493003: [ServiceWorker] Plumbing the request credentials mode to the ServiceWorker. [2/2 chromium] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/service_worker/service_worker_types.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "content/child/thread_safe_sender.h" 10 #include "content/child/thread_safe_sender.h"
(...skipping 21 matching lines...) Expand all
32 sender->Send(new ServiceWorkerHostMsg_PostMessageToDocument( 32 sender->Send(new ServiceWorkerHostMsg_PostMessageToDocument(
33 routing_id, client_id, message, 33 routing_id, client_id, message,
34 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels.release()))); 34 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels.release())));
35 } 35 }
36 36
37 blink::WebURLRequest::FetchRequestMode GetBlinkFetchRequestMode( 37 blink::WebURLRequest::FetchRequestMode GetBlinkFetchRequestMode(
38 FetchRequestMode mode) { 38 FetchRequestMode mode) {
39 return static_cast<blink::WebURLRequest::FetchRequestMode>(mode); 39 return static_cast<blink::WebURLRequest::FetchRequestMode>(mode);
40 } 40 }
41 41
42 blink::WebURLRequest::FetchCredentialsMode GetBlinkFetchCredentialsMode(
43 FetchCredentialsMode credentials_mode) {
44 return static_cast<blink::WebURLRequest::FetchCredentialsMode>(
45 credentials_mode);
46 }
47
42 } // namespace 48 } // namespace
43 49
44 ServiceWorkerScriptContext::ServiceWorkerScriptContext( 50 ServiceWorkerScriptContext::ServiceWorkerScriptContext(
45 EmbeddedWorkerContextClient* embedded_context, 51 EmbeddedWorkerContextClient* embedded_context,
46 blink::WebServiceWorkerContextProxy* proxy) 52 blink::WebServiceWorkerContextProxy* proxy)
47 : cache_storage_dispatcher_(new ServiceWorkerCacheStorageDispatcher(this)), 53 : cache_storage_dispatcher_(new ServiceWorkerCacheStorageDispatcher(this)),
48 embedded_context_(embedded_context), 54 embedded_context_(embedded_context),
49 proxy_(proxy) { 55 proxy_(proxy) {
50 } 56 }
51 57
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 webRequest.setHeader(blink::WebString::fromUTF8(it->first), 182 webRequest.setHeader(blink::WebString::fromUTF8(it->first),
177 blink::WebString::fromUTF8(it->second)); 183 blink::WebString::fromUTF8(it->second));
178 } 184 }
179 if (!request.blob_uuid.empty()) { 185 if (!request.blob_uuid.empty()) {
180 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), 186 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid),
181 request.blob_size); 187 request.blob_size);
182 } 188 }
183 webRequest.setReferrer(blink::WebString::fromUTF8(request.referrer.spec()), 189 webRequest.setReferrer(blink::WebString::fromUTF8(request.referrer.spec()),
184 blink::WebReferrerPolicyDefault); 190 blink::WebReferrerPolicyDefault);
185 webRequest.setMode(GetBlinkFetchRequestMode(request.mode)); 191 webRequest.setMode(GetBlinkFetchRequestMode(request.mode));
192 webRequest.setCredentialsMode(
193 GetBlinkFetchCredentialsMode(request.credentials_mode));
186 webRequest.setIsReload(request.is_reload); 194 webRequest.setIsReload(request.is_reload);
187 fetch_start_timings_[request_id] = base::TimeTicks::Now(); 195 fetch_start_timings_[request_id] = base::TimeTicks::Now();
188 proxy_->dispatchFetchEvent(request_id, webRequest); 196 proxy_->dispatchFetchEvent(request_id, webRequest);
189 } 197 }
190 198
191 void ServiceWorkerScriptContext::OnSyncEvent(int request_id) { 199 void ServiceWorkerScriptContext::OnSyncEvent(int request_id) {
192 TRACE_EVENT0("ServiceWorker", 200 TRACE_EVENT0("ServiceWorker",
193 "ServiceWorkerScriptContext::OnSyncEvent"); 201 "ServiceWorkerScriptContext::OnSyncEvent");
194 proxy_->dispatchSyncEvent(request_id); 202 proxy_->dispatchSyncEvent(request_id);
195 } 203 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return; 241 return;
234 } 242 }
235 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( 243 scoped_ptr<blink::WebServiceWorkerClientsInfo> info(
236 new blink::WebServiceWorkerClientsInfo); 244 new blink::WebServiceWorkerClientsInfo);
237 info->clientIDs = client_ids; 245 info->clientIDs = client_ids;
238 callbacks->onSuccess(info.release()); 246 callbacks->onSuccess(info.release());
239 pending_clients_callbacks_.Remove(request_id); 247 pending_clients_callbacks_.Remove(request_id);
240 } 248 }
241 249
242 } // namespace content 250 } // namespace content
OLDNEW
« no previous file with comments | « content/common/service_worker/service_worker_types.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698