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

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

Issue 1271733002: [2/3 chromium] Support redirect option of Request and "opaqueredirect" response type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add _MODE to avoid compile error at Windows. Created 5 years, 4 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 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 "base/lazy_instance.h" 7 #include "base/lazy_instance.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 "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 FetchRequestMode mode) { 124 FetchRequestMode mode) {
125 return static_cast<blink::WebURLRequest::FetchRequestMode>(mode); 125 return static_cast<blink::WebURLRequest::FetchRequestMode>(mode);
126 } 126 }
127 127
128 blink::WebURLRequest::FetchCredentialsMode GetBlinkFetchCredentialsMode( 128 blink::WebURLRequest::FetchCredentialsMode GetBlinkFetchCredentialsMode(
129 FetchCredentialsMode credentials_mode) { 129 FetchCredentialsMode credentials_mode) {
130 return static_cast<blink::WebURLRequest::FetchCredentialsMode>( 130 return static_cast<blink::WebURLRequest::FetchCredentialsMode>(
131 credentials_mode); 131 credentials_mode);
132 } 132 }
133 133
134 blink::WebURLRequest::FetchRedirectMode GetBlinkFetchRedirectMode(
135 FetchRedirectMode redirect_mode) {
136 return static_cast<blink::WebURLRequest::FetchRedirectMode>(redirect_mode);
137 }
138
134 blink::WebURLRequest::RequestContext GetBlinkRequestContext( 139 blink::WebURLRequest::RequestContext GetBlinkRequestContext(
135 RequestContextType request_context_type) { 140 RequestContextType request_context_type) {
136 return static_cast<blink::WebURLRequest::RequestContext>( 141 return static_cast<blink::WebURLRequest::RequestContext>(
137 request_context_type); 142 request_context_type);
138 } 143 }
139 144
140 blink::WebURLRequest::FrameType GetBlinkFrameType( 145 blink::WebURLRequest::FrameType GetBlinkFrameType(
141 RequestContextFrameType frame_type) { 146 RequestContextFrameType frame_type) {
142 return static_cast<blink::WebURLRequest::FrameType>(frame_type); 147 return static_cast<blink::WebURLRequest::FrameType>(frame_type);
143 } 148 }
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if (!request.blob_uuid.empty()) { 702 if (!request.blob_uuid.empty()) {
698 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), 703 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid),
699 request.blob_size); 704 request.blob_size);
700 } 705 }
701 webRequest.setReferrer( 706 webRequest.setReferrer(
702 blink::WebString::fromUTF8(request.referrer.url.spec()), 707 blink::WebString::fromUTF8(request.referrer.url.spec()),
703 request.referrer.policy); 708 request.referrer.policy);
704 webRequest.setMode(GetBlinkFetchRequestMode(request.mode)); 709 webRequest.setMode(GetBlinkFetchRequestMode(request.mode));
705 webRequest.setCredentialsMode( 710 webRequest.setCredentialsMode(
706 GetBlinkFetchCredentialsMode(request.credentials_mode)); 711 GetBlinkFetchCredentialsMode(request.credentials_mode));
712 webRequest.setRedirectMode(GetBlinkFetchRedirectMode(request.redirect_mode));
707 webRequest.setRequestContext( 713 webRequest.setRequestContext(
708 GetBlinkRequestContext(request.request_context_type)); 714 GetBlinkRequestContext(request.request_context_type));
709 webRequest.setFrameType(GetBlinkFrameType(request.frame_type)); 715 webRequest.setFrameType(GetBlinkFrameType(request.frame_type));
710 webRequest.setIsReload(request.is_reload); 716 webRequest.setIsReload(request.is_reload);
711 proxy_->dispatchFetchEvent(request_id, webRequest); 717 proxy_->dispatchFetchEvent(request_id, webRequest);
712 } 718 }
713 719
714 void ServiceWorkerContextClient::OnNotificationClickEvent( 720 void ServiceWorkerContextClient::OnNotificationClickEvent(
715 int request_id, 721 int request_id,
716 int64_t persistent_notification_id, 722 int64_t persistent_notification_id,
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 } 958 }
953 959
954 base::WeakPtr<ServiceWorkerContextClient> 960 base::WeakPtr<ServiceWorkerContextClient>
955 ServiceWorkerContextClient::GetWeakPtr() { 961 ServiceWorkerContextClient::GetWeakPtr() {
956 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 962 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
957 DCHECK(context_); 963 DCHECK(context_);
958 return context_->weak_factory.GetWeakPtr(); 964 return context_->weak_factory.GetWeakPtr();
959 } 965 }
960 966
961 } // namespace content 967 } // 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