Chromium Code Reviews| 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/browser/service_worker/service_worker_test_utils.h" | 5 #include "content/browser/service_worker/service_worker_test_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/service_worker/service_worker_provider_host.h" | 9 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 ServiceWorkerRemoteProviderEndpoint::ServiceWorkerRemoteProviderEndpoint() {} | |
| 14 ServiceWorkerRemoteProviderEndpoint::ServiceWorkerRemoteProviderEndpoint( | |
| 15 ServiceWorkerRemoteProviderEndpoint&& other) | |
| 16 : host_ptr(std::move(other.host_ptr)), | |
| 17 client_request(std::move(other.client_request)) {} | |
| 18 | |
| 19 ServiceWorkerRemoteProviderEndpoint::~ServiceWorkerRemoteProviderEndpoint() {} | |
| 20 | |
| 13 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( | 21 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
| 14 int process_id, | 22 int process_id, |
| 15 int provider_id, | 23 int provider_id, |
| 16 bool is_parent_frame_secure, | 24 bool is_parent_frame_secure, |
| 17 base::WeakPtr<ServiceWorkerContextCore> context) { | 25 base::WeakPtr<ServiceWorkerContextCore> context, |
| 26 ServiceWorkerRemoteProviderEndpoint* output_endpoint) { | |
| 18 ServiceWorkerProviderHostInfo info(provider_id, MSG_ROUTING_NONE, | 27 ServiceWorkerProviderHostInfo info(provider_id, MSG_ROUTING_NONE, |
| 19 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 28 SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
| 20 is_parent_frame_secure); | 29 is_parent_frame_secure); |
| 30 mojom::ServiceWorkerProviderAssociatedPtr client_ptr; | |
| 31 output_endpoint->client_request = mojo::MakeIsolatedRequest(&client_ptr); | |
| 32 info.client_ptr_info = client_ptr.PassInterface(); | |
| 33 info.host_request = mojo::MakeIsolatedRequest(&output_endpoint->host_ptr); | |
|
falken
2017/05/22 08:28:12
these four lines seem to be repeated throughout th
shimazu
2017/05/23 06:29:34
Done.
| |
| 21 return ServiceWorkerProviderHost::Create(process_id, std::move(info), | 34 return ServiceWorkerProviderHost::Create(process_id, std::move(info), |
| 22 std::move(context), nullptr); | 35 std::move(context), nullptr); |
| 23 } | 36 } |
| 24 | 37 |
| 25 std::unique_ptr<ServiceWorkerProviderHost> | 38 std::unique_ptr<ServiceWorkerProviderHost> |
| 26 CreateProviderHostForServiceWorkerContext( | 39 CreateProviderHostForServiceWorkerContext( |
| 27 int process_id, | 40 int process_id, |
| 28 int provider_id, | 41 int provider_id, |
| 29 bool is_parent_frame_secure, | 42 bool is_parent_frame_secure, |
| 30 base::WeakPtr<ServiceWorkerContextCore> context) { | 43 base::WeakPtr<ServiceWorkerContextCore> context, |
| 44 ServiceWorkerRemoteProviderEndpoint* output_endpoint) { | |
| 31 ServiceWorkerProviderHostInfo info(provider_id, MSG_ROUTING_NONE, | 45 ServiceWorkerProviderHostInfo info(provider_id, MSG_ROUTING_NONE, |
| 32 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | 46 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, |
| 33 is_parent_frame_secure); | 47 is_parent_frame_secure); |
| 48 mojom::ServiceWorkerProviderAssociatedPtr client_ptr; | |
| 49 output_endpoint->client_request = mojo::MakeIsolatedRequest(&client_ptr); | |
| 50 info.client_ptr_info = client_ptr.PassInterface(); | |
| 51 info.host_request = mojo::MakeIsolatedRequest(&output_endpoint->host_ptr); | |
| 34 return ServiceWorkerProviderHost::Create(process_id, std::move(info), | 52 return ServiceWorkerProviderHost::Create(process_id, std::move(info), |
| 35 std::move(context), nullptr); | 53 std::move(context), nullptr); |
| 36 } | 54 } |
| 37 | 55 |
| 38 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( | 56 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( |
| 39 int process_id, | 57 int process_id, |
| 40 int provider_id, | 58 int provider_id, |
| 41 base::WeakPtr<ServiceWorkerContextCore> context, | 59 base::WeakPtr<ServiceWorkerContextCore> context, |
| 42 int route_id, | 60 int route_id, |
| 43 ServiceWorkerDispatcherHost* dispatcher_host) { | 61 ServiceWorkerDispatcherHost* dispatcher_host, |
| 62 ServiceWorkerRemoteProviderEndpoint* output_endpoint) { | |
| 44 ServiceWorkerProviderHostInfo info(provider_id, route_id, | 63 ServiceWorkerProviderHostInfo info(provider_id, route_id, |
| 45 SERVICE_WORKER_PROVIDER_FOR_WINDOW, true); | 64 SERVICE_WORKER_PROVIDER_FOR_WINDOW, true); |
| 65 mojom::ServiceWorkerProviderAssociatedPtr client_ptr; | |
| 66 output_endpoint->client_request = mojo::MakeIsolatedRequest(&client_ptr); | |
| 67 info.client_ptr_info = client_ptr.PassInterface(); | |
| 68 info.host_request = mojo::MakeIsolatedRequest(&output_endpoint->host_ptr); | |
| 46 return ServiceWorkerProviderHost::Create(process_id, std::move(info), | 69 return ServiceWorkerProviderHost::Create(process_id, std::move(info), |
| 47 std::move(context), dispatcher_host); | 70 std::move(context), dispatcher_host); |
| 48 } | 71 } |
| 49 | 72 |
| 50 } // namespace content | 73 } // namespace content |
| OLD | NEW |