1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_OBJECT_INFO_H_ 6 #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_OBJECT_INFO_H_ 7 8 #include "base/macros.h" 9 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" 10 #include "third_party/blink/public/mojom/service_worker/service_worker_state.mojom-shared.h" 11 #include "third_party/blink/public/platform/web_url.h" 12 13 namespace blink { 14 15 // This is to carry blink.mojom.ServiceWorkerObjectInfo data from //content 16 // across the boundary into Blink. 17 // TODO(crbug.com/879019): Remove this class once we make the following Mojo 18 // interfaces receive blink.mojom.ServiceWorkerObjectInfo directly inside Blink. 19 // - content.mojom.ServiceWorkerContainer 20 // 21 // As we're on the border line between non-Blink and Blink variants, we need 22 // to use mojo::ScopedInterfaceEndpointHandle to pass Mojo types. 23 struct WebServiceWorkerObjectInfo { WebServiceWorkerObjectInfoWebServiceWorkerObjectInfo24 WebServiceWorkerObjectInfo(int64_t version_id, 25 mojom::ServiceWorkerState state, 26 WebURL url, 27 mojo::ScopedInterfaceEndpointHandle host_remote, 28 mojo::ScopedInterfaceEndpointHandle receiver) 29 : version_id(version_id), 30 state(state), 31 url(std::move(url)), 32 host_remote(std::move(host_remote)), 33 receiver(std::move(receiver)) {} 34 WebServiceWorkerObjectInfo(WebServiceWorkerObjectInfo&& other) = default; 35 36 int64_t version_id; 37 mojom::ServiceWorkerState state; 38 WebURL url; 39 // For PendingAssociatedRemote<blink::mojom::ServiceWorkerObjectHost>. 40 mojo::ScopedInterfaceEndpointHandle host_remote; 41 // For AssociatedReceiver<blink::mojom::ServiceWorkerObject>. 42 mojo::ScopedInterfaceEndpointHandle receiver; 43 44 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerObjectInfo); 45 }; 46 47 } // namespace blink 48 49 #endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_OBJECT_INFO_H_ 50