Chromium Code Reviews| 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 "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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 FetchRequestMode mode) { | 123 FetchRequestMode mode) { |
| 124 return static_cast<blink::WebURLRequest::FetchRequestMode>(mode); | 124 return static_cast<blink::WebURLRequest::FetchRequestMode>(mode); |
| 125 } | 125 } |
| 126 | 126 |
| 127 blink::WebURLRequest::FetchCredentialsMode GetBlinkFetchCredentialsMode( | 127 blink::WebURLRequest::FetchCredentialsMode GetBlinkFetchCredentialsMode( |
| 128 FetchCredentialsMode credentials_mode) { | 128 FetchCredentialsMode credentials_mode) { |
| 129 return static_cast<blink::WebURLRequest::FetchCredentialsMode>( | 129 return static_cast<blink::WebURLRequest::FetchCredentialsMode>( |
| 130 credentials_mode); | 130 credentials_mode); |
| 131 } | 131 } |
| 132 | 132 |
| 133 blink::WebURLRequest::FetchRedirectMode GetBlinkFetchRedirectMode( | |
| 134 FetchRedirectMode redirect_mode) { | |
| 135 return static_cast<blink::WebURLRequest::FetchRedirectMode>(redirect_mode); | |
|
yhirano
2015/08/10 04:57:52
If you rely on the fact that these two enums share
horo
2015/08/10 06:45:18
We have STATIC_ASSERT_MATCHING_ENUMS() in web_url_
yhirano
2015/08/10 07:03:07
Acknowledged.
| |
| 136 } | |
| 137 | |
| 133 blink::WebURLRequest::RequestContext GetBlinkRequestContext( | 138 blink::WebURLRequest::RequestContext GetBlinkRequestContext( |
| 134 RequestContextType request_context_type) { | 139 RequestContextType request_context_type) { |
| 135 return static_cast<blink::WebURLRequest::RequestContext>( | 140 return static_cast<blink::WebURLRequest::RequestContext>( |
| 136 request_context_type); | 141 request_context_type); |
| 137 } | 142 } |
| 138 | 143 |
| 139 blink::WebURLRequest::FrameType GetBlinkFrameType( | 144 blink::WebURLRequest::FrameType GetBlinkFrameType( |
| 140 RequestContextFrameType frame_type) { | 145 RequestContextFrameType frame_type) { |
| 141 return static_cast<blink::WebURLRequest::FrameType>(frame_type); | 146 return static_cast<blink::WebURLRequest::FrameType>(frame_type); |
| 142 } | 147 } |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 if (!request.blob_uuid.empty()) { | 701 if (!request.blob_uuid.empty()) { |
| 697 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), | 702 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), |
| 698 request.blob_size); | 703 request.blob_size); |
| 699 } | 704 } |
| 700 webRequest.setReferrer( | 705 webRequest.setReferrer( |
| 701 blink::WebString::fromUTF8(request.referrer.url.spec()), | 706 blink::WebString::fromUTF8(request.referrer.url.spec()), |
| 702 request.referrer.policy); | 707 request.referrer.policy); |
| 703 webRequest.setMode(GetBlinkFetchRequestMode(request.mode)); | 708 webRequest.setMode(GetBlinkFetchRequestMode(request.mode)); |
| 704 webRequest.setCredentialsMode( | 709 webRequest.setCredentialsMode( |
| 705 GetBlinkFetchCredentialsMode(request.credentials_mode)); | 710 GetBlinkFetchCredentialsMode(request.credentials_mode)); |
| 711 webRequest.setRedirectMode(GetBlinkFetchRedirectMode(request.redirect_mode)); | |
| 706 webRequest.setRequestContext( | 712 webRequest.setRequestContext( |
| 707 GetBlinkRequestContext(request.request_context_type)); | 713 GetBlinkRequestContext(request.request_context_type)); |
| 708 webRequest.setFrameType(GetBlinkFrameType(request.frame_type)); | 714 webRequest.setFrameType(GetBlinkFrameType(request.frame_type)); |
| 709 webRequest.setIsReload(request.is_reload); | 715 webRequest.setIsReload(request.is_reload); |
| 710 proxy_->dispatchFetchEvent(request_id, webRequest); | 716 proxy_->dispatchFetchEvent(request_id, webRequest); |
| 711 } | 717 } |
| 712 | 718 |
| 713 void ServiceWorkerContextClient::OnNotificationClickEvent( | 719 void ServiceWorkerContextClient::OnNotificationClickEvent( |
| 714 int request_id, | 720 int request_id, |
| 715 int64_t persistent_notification_id, | 721 int64_t persistent_notification_id, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 } | 966 } |
| 961 | 967 |
| 962 base::WeakPtr<ServiceWorkerContextClient> | 968 base::WeakPtr<ServiceWorkerContextClient> |
| 963 ServiceWorkerContextClient::GetWeakPtr() { | 969 ServiceWorkerContextClient::GetWeakPtr() { |
| 964 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 970 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 965 DCHECK(context_); | 971 DCHECK(context_); |
| 966 return context_->weak_factory.GetWeakPtr(); | 972 return context_->weak_factory.GetWeakPtr(); |
| 967 } | 973 } |
| 968 | 974 |
| 969 } // namespace content | 975 } // namespace content |
| OLD | NEW |