summaryrefslogtreecommitdiffstats
path: root/dom/presentation/ipc/PPresentation.ipdl
blob: bfaca8fb573aa85d0f5aa12b02ca83730687970a (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PContent;
include protocol PPresentationRequest;
include protocol PPresentationBuilder;

include InputStreamParams;

include "mozilla/dom/PermissionMessageUtils.h";

using refcounted class nsIPrincipal from "nsIPrincipal.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";

namespace mozilla {
namespace dom {

struct StartSessionRequest
{
  nsString[] urls;
  nsString sessionId;
  nsString origin;
  nsString deviceId;
  uint64_t windowId;
  TabId tabId;
  nsIPrincipal principal;
};

struct SendSessionMessageRequest
{
  nsString sessionId;
  uint8_t role;
  nsString data;
};

struct CloseSessionRequest
{
  nsString sessionId;
  uint8_t role;
  uint8_t closedReason;
};

struct TerminateSessionRequest
{
  nsString sessionId;
  uint8_t role;
};

struct ReconnectSessionRequest
{
  nsString[] urls;
  nsString sessionId;
  uint8_t role;
};

struct BuildTransportRequest
{
  nsString sessionId;
  uint8_t role;
};

union PresentationIPCRequest
{
  StartSessionRequest;
  SendSessionMessageRequest;
  CloseSessionRequest;
  TerminateSessionRequest;
  ReconnectSessionRequest;
  BuildTransportRequest;
};

sync protocol PPresentation
{
  manager PContent;
  manages PPresentationBuilder;
  manages PPresentationRequest;

child:
  async NotifyAvailableChange(nsString[] aAvailabilityUrls,
                              bool aAvailable);
  async NotifySessionStateChange(nsString aSessionId,
                                 uint16_t aState,
                                 nsresult aReason);
  async NotifyMessage(nsString aSessionId, nsCString aData, bool aIsBinary);
  async NotifySessionConnect(uint64_t aWindowId, nsString aSessionId);
  async NotifyCloseSessionTransport(nsString aSessionId,
                                    uint8_t aRole,
                                    nsresult aReason);

  async PPresentationBuilder(nsString aSessionId, uint8_t aRole);

parent:
  async __delete__();

  async RegisterAvailabilityHandler(nsString[] aAvailabilityUrls);
  async UnregisterAvailabilityHandler(nsString[] aAvailabilityUrls);

  async RegisterSessionHandler(nsString aSessionId, uint8_t aRole);
  async UnregisterSessionHandler(nsString aSessionId, uint8_t aRole);

  async RegisterRespondingHandler(uint64_t aWindowId);
  async UnregisterRespondingHandler(uint64_t aWindowId);

  async PPresentationRequest(PresentationIPCRequest aRequest);

  async NotifyReceiverReady(nsString aSessionId, uint64_t aWindowId, bool aIsLoading);
  async NotifyTransportClosed(nsString aSessionId, uint8_t aRole, nsresult aReason);
};

} // namespace dom
} // namespace mozilla