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/child/service_worker/service_worker_network_provider.h" | 5 #include "content/child/service_worker/service_worker_network_provider.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "content/child/child_thread_impl.h" | 8 #include "content/child/child_thread_impl.h" |
9 #include "content/child/service_worker/service_worker_provider_context.h" | 9 #include "content/child/service_worker/service_worker_provider_context.h" |
10 #include "content/common/navigation_params.h" | 10 #include "content/common/navigation_params.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 service_worker_provider_id)); | 90 service_worker_provider_id)); |
91 network_provider = scoped_ptr<ServiceWorkerNetworkProvider>( | 91 network_provider = scoped_ptr<ServiceWorkerNetworkProvider>( |
92 new ServiceWorkerNetworkProvider(route_id, | 92 new ServiceWorkerNetworkProvider(route_id, |
93 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 93 SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
94 service_worker_provider_id)); | 94 service_worker_provider_id)); |
95 } | 95 } |
96 } else { | 96 } else { |
97 network_provider = scoped_ptr<ServiceWorkerNetworkProvider>( | 97 network_provider = scoped_ptr<ServiceWorkerNetworkProvider>( |
98 new ServiceWorkerNetworkProvider()); | 98 new ServiceWorkerNetworkProvider()); |
99 } | 99 } |
100 return network_provider.Pass(); | 100 return network_provider; |
101 } | 101 } |
102 | 102 |
103 ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( | 103 ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( |
104 int route_id, | 104 int route_id, |
105 ServiceWorkerProviderType provider_type, | 105 ServiceWorkerProviderType provider_type, |
106 int browser_provider_id) | 106 int browser_provider_id) |
107 : provider_id_(browser_provider_id) { | 107 : provider_id_(browser_provider_id) { |
108 if (provider_id_ == kInvalidServiceWorkerProviderId) | 108 if (provider_id_ == kInvalidServiceWorkerProviderId) |
109 return; | 109 return; |
110 if (!ChildThreadImpl::current()) | 110 if (!ChildThreadImpl::current()) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return; // May be null in some tests. | 142 return; // May be null in some tests. |
143 ChildThreadImpl::current()->Send( | 143 ChildThreadImpl::current()->Send( |
144 new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); | 144 new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); |
145 } | 145 } |
146 | 146 |
147 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { | 147 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { |
148 return context() && context()->controller(); | 148 return context() && context()->controller(); |
149 } | 149 } |
150 | 150 |
151 } // namespace content | 151 } // namespace content |
OLD | NEW |