| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/worker_fetch_context_impl.h" | 5 #include "content/renderer/service_worker/worker_fetch_context_impl.h" |
| 6 | 6 |
| 7 #include "content/child/child_thread_impl.h" | 7 #include "content/child/child_thread_impl.h" |
| 8 #include "content/child/request_extra_data.h" | 8 #include "content/child/request_extra_data.h" |
| 9 #include "content/child/resource_dispatcher.h" | 9 #include "content/child/resource_dispatcher.h" |
| 10 #include "content/child/thread_safe_sender.h" | 10 #include "content/child/thread_safe_sender.h" |
| 11 #include "content/child/web_url_loader_impl.h" | 11 #include "content/child/web_url_loader_impl.h" |
| 12 #include "content/common/frame_messages.h" | 12 #include "content/common/frame_messages.h" |
| 13 #include "mojo/public/cpp/bindings/associated_binding.h" | 13 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 14 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 WorkerFetchContextImpl::WorkerFetchContextImpl( | 18 WorkerFetchContextImpl::WorkerFetchContextImpl( |
| 18 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info) | 19 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info) |
| 19 : provider_info_(std::move(provider_info)), | 20 : provider_info_(std::move(provider_info)), |
| 20 thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} | 21 thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} |
| 21 | 22 |
| 22 WorkerFetchContextImpl::~WorkerFetchContextImpl() {} | 23 WorkerFetchContextImpl::~WorkerFetchContextImpl() {} |
| 23 | 24 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 66 } |
| 66 | 67 |
| 67 void WorkerFetchContextImpl::SetDataSaverEnabled(bool enabled) { | 68 void WorkerFetchContextImpl::SetDataSaverEnabled(bool enabled) { |
| 68 is_data_saver_enabled_ = enabled; | 69 is_data_saver_enabled_ = enabled; |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool WorkerFetchContextImpl::IsDataSaverEnabled() const { | 72 bool WorkerFetchContextImpl::IsDataSaverEnabled() const { |
| 72 return is_data_saver_enabled_; | 73 return is_data_saver_enabled_; |
| 73 } | 74 } |
| 74 | 75 |
| 76 int64_t WorkerFetchContextImpl::ServiceWorkerID() const { |
| 77 return controller_version_id_; |
| 78 } |
| 79 |
| 75 blink::WebURL WorkerFetchContextImpl::FirstPartyForCookies() const { | 80 blink::WebURL WorkerFetchContextImpl::FirstPartyForCookies() const { |
| 76 return first_party_for_cookies_; | 81 return first_party_for_cookies_; |
| 77 } | 82 } |
| 78 | 83 |
| 79 void WorkerFetchContextImpl::DidRunContentWithCertificateErrors( | 84 void WorkerFetchContextImpl::DidRunContentWithCertificateErrors( |
| 80 const blink::WebURL& url) { | 85 const blink::WebURL& url) { |
| 81 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(parent_frame_id_, | 86 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(parent_frame_id_, |
| 82 url)); | 87 url)); |
| 83 } | 88 } |
| 84 | 89 |
| 85 void WorkerFetchContextImpl::DidDisplayContentWithCertificateErrors( | 90 void WorkerFetchContextImpl::DidDisplayContentWithCertificateErrors( |
| 86 const blink::WebURL& url) { | 91 const blink::WebURL& url) { |
| 87 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors(parent_frame_id_, | 92 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors(parent_frame_id_, |
| 88 url)); | 93 url)); |
| 89 } | 94 } |
| 90 | 95 |
| 91 void WorkerFetchContextImpl::set_service_worker_provider_id(int id) { | 96 void WorkerFetchContextImpl::set_service_worker_provider_id(int id) { |
| 92 service_worker_provider_id_ = id; | 97 service_worker_provider_id_ = id; |
| 93 } | 98 } |
| 94 | 99 |
| 95 void WorkerFetchContextImpl::set_is_controlled_by_service_worker(bool flag) { | 100 void WorkerFetchContextImpl::set_is_controlled_by_service_worker(bool flag) { |
| 96 is_controlled_by_service_worker_ = flag; | 101 is_controlled_by_service_worker_ = flag; |
| 97 } | 102 } |
| 98 | 103 |
| 104 void WorkerFetchContextImpl::SetAppCacheHostID(int id) { |
| 105 appcache_host_id_ = id; |
| 106 } |
| 107 |
| 99 void WorkerFetchContextImpl::set_parent_frame_id(int id) { | 108 void WorkerFetchContextImpl::set_parent_frame_id(int id) { |
| 100 parent_frame_id_ = id; | 109 parent_frame_id_ = id; |
| 101 } | 110 } |
| 102 | 111 |
| 103 void WorkerFetchContextImpl::set_first_party_for_cookies( | 112 void WorkerFetchContextImpl::set_first_party_for_cookies( |
| 104 const blink::WebURL& first_party_for_cookies) { | 113 const blink::WebURL& first_party_for_cookies) { |
| 105 first_party_for_cookies_ = first_party_for_cookies; | 114 first_party_for_cookies_ = first_party_for_cookies; |
| 106 } | 115 } |
| 107 | 116 |
| 108 void WorkerFetchContextImpl::set_is_secure_context(bool flag) { | 117 void WorkerFetchContextImpl::set_is_secure_context(bool flag) { |
| 109 is_secure_context_ = flag; | 118 is_secure_context_ = flag; |
| 110 } | 119 } |
| 111 | 120 |
| 112 void WorkerFetchContextImpl::SetControllerServiceWorker( | 121 void WorkerFetchContextImpl::SetControllerServiceWorker( |
| 113 int64_t controller_version_id) { | 122 int64_t controller_version_id) { |
| 114 controller_version_id_ = controller_version_id; | 123 controller_version_id_ = controller_version_id; |
| 115 } | 124 } |
| 116 | 125 |
| 117 bool WorkerFetchContextImpl::Send(IPC::Message* message) { | 126 bool WorkerFetchContextImpl::Send(IPC::Message* message) { |
| 118 return thread_safe_sender_->Send(message); | 127 return thread_safe_sender_->Send(message); |
| 119 } | 128 } |
| 120 | 129 |
| 121 } // namespace content | 130 } // namespace content |
| OLD | NEW |