summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_registration_object_info.h
blob: cdc2b575963cd7d8a07a51981e959e50a76679f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_OBJECT_INFO_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_OBJECT_INFO_H_

#include "base/macros.h"
#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom-shared.h"
#include "third_party/blink/public/platform/modules/service_worker/web_service_worker_object_info.h"
#include "third_party/blink/public/platform/web_url.h"

namespace blink {

// This is to carry blink.mojom.ServiceWorkerRegistrationObjectInfo data from
// //content across the boundary into Blink.
// TODO(crbug.com/879019): Remove this class once we make the following Mojo
// interfaces receive blink.mojom.ServiceWorkerRegistrationObjectInfo directly
// inside Blink.
//  - content.mojom.ServiceWorker
//  - content.mojom.ServiceWorkerContainer
//
// As we're on the border line between non-Blink and Blink variants, we need
// to use mojo::ScopedInterfaceEndpointHandle to pass Mojo types.
struct WebServiceWorkerRegistrationObjectInfo {
  WebServiceWorkerRegistrationObjectInfo(
      int64_t registration_id,
      WebURL scope,
      mojom::ScriptType type,
      mojom::ServiceWorkerUpdateViaCache update_via_cache,
      mojo::ScopedInterfaceEndpointHandle host_ptr_info,
      mojo::ScopedInterfaceEndpointHandle request,
      WebServiceWorkerObjectInfo installing,
      WebServiceWorkerObjectInfo waiting,
      WebServiceWorkerObjectInfo active)
      : registration_id(registration_id),
        scope(std::move(scope)),
        type(type),
        update_via_cache(update_via_cache),
        host_ptr_info(std::move(host_ptr_info)),
        request(std::move(request)),
        installing(std::move(installing)),
        waiting(std::move(waiting)),
        active(std::move(active)) {}
  WebServiceWorkerRegistrationObjectInfo(
      WebServiceWorkerRegistrationObjectInfo&& other) = default;

  int64_t registration_id;

  WebURL scope;
  mojom::ScriptType type;
  mojom::ServiceWorkerUpdateViaCache update_via_cache;

  // For blink::mojom::ServiceWorkerRegistrationObjectHostAssociatedPtrInfo.
  mojo::ScopedInterfaceEndpointHandle host_ptr_info;
  // For blink::mojom::ServiceWorkerRegistrationObjectAssociatedRequest.
  mojo::ScopedInterfaceEndpointHandle request;

  WebServiceWorkerObjectInfo installing;
  WebServiceWorkerObjectInfo waiting;
  WebServiceWorkerObjectInfo active;

  DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerRegistrationObjectInfo);
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_SERVICE_WORKER_WEB_SERVICE_WORKER_REGISTRATION_OBJECT_INFO_H_