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_REGISTRATION_OBJECT_INFO_H_
6 #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_OBJECT_INFO_H_
7 
8 #include "base/macros.h"
9 #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom-shared.h"
10 #include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom-shared.h"
11 #include "third_party/blink/public/platform/cross_variant_mojo_util.h"
12 #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_object_info.h"
13 #include "third_party/blink/public/platform/web_url.h"
14 
15 namespace blink {
16 
17 // This is to carry blink.mojom.ServiceWorkerRegistrationObjectInfo data from
18 // //content across the boundary into Blink.
19 // TODO(crbug.com/879019): Remove this class once we make the following Mojo
20 // interfaces receive blink.mojom.ServiceWorkerRegistrationObjectInfo directly
21 // inside Blink.
22 //  - content.mojom.ServiceWorker
23 //  - content.mojom.ServiceWorkerContainer
24 struct WebServiceWorkerRegistrationObjectInfo {
WebServiceWorkerRegistrationObjectInfoWebServiceWorkerRegistrationObjectInfo25   WebServiceWorkerRegistrationObjectInfo(
26       int64_t registration_id,
27       WebURL scope,
28       mojom::ServiceWorkerUpdateViaCache update_via_cache,
29       CrossVariantMojoAssociatedRemote<
30           mojom::ServiceWorkerRegistrationObjectHostInterfaceBase> host_remote,
31       CrossVariantMojoAssociatedReceiver<
32           mojom::ServiceWorkerRegistrationObjectInterfaceBase> receiver,
33       WebServiceWorkerObjectInfo installing,
34       WebServiceWorkerObjectInfo waiting,
35       WebServiceWorkerObjectInfo active)
36       : registration_id(registration_id),
37         scope(std::move(scope)),
38         update_via_cache(update_via_cache),
39         host_remote(std::move(host_remote)),
40         receiver(std::move(receiver)),
41         installing(std::move(installing)),
42         waiting(std::move(waiting)),
43         active(std::move(active)) {}
44   WebServiceWorkerRegistrationObjectInfo(
45       WebServiceWorkerRegistrationObjectInfo&& other) = default;
46 
47   int64_t registration_id;
48 
49   WebURL scope;
50   mojom::ServiceWorkerUpdateViaCache update_via_cache;
51 
52   CrossVariantMojoAssociatedRemote<
53       mojom::ServiceWorkerRegistrationObjectHostInterfaceBase>
54       host_remote;
55   CrossVariantMojoAssociatedReceiver<
56       mojom::ServiceWorkerRegistrationObjectInterfaceBase>
57       receiver;
58 
59   WebServiceWorkerObjectInfo installing;
60   WebServiceWorkerObjectInfo waiting;
61   WebServiceWorkerObjectInfo active;
62 
63   DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerRegistrationObjectInfo);
64 };
65 
66 }  // namespace blink
67 
68 #endif  // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_OBJECT_INFO_H_
69