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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_PresentationParent_h__
#define mozilla_dom_PresentationParent_h__
#include "mozilla/dom/ipc/IdType.h"
#include "mozilla/dom/PPresentationBuilderParent.h"
#include "mozilla/dom/PPresentationParent.h"
#include "mozilla/dom/PPresentationRequestParent.h"
#include "nsIPresentationListener.h"
#include "nsIPresentationService.h"
#include "nsIPresentationSessionTransportBuilder.h"
namespace mozilla {
namespace dom {
class PresentationParent final : public PPresentationParent
, public nsIPresentationAvailabilityListener
, public nsIPresentationSessionListener
, public nsIPresentationRespondingListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPRESENTATIONAVAILABILITYLISTENER
NS_DECL_NSIPRESENTATIONSESSIONLISTENER
NS_DECL_NSIPRESENTATIONRESPONDINGLISTENER
PresentationParent();
bool Init(ContentParentId aContentParentId);
bool RegisterTransportBuilder(const nsString& aSessionId, const uint8_t& aRole);
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual bool
RecvPPresentationRequestConstructor(PPresentationRequestParent* aActor,
const PresentationIPCRequest& aRequest) override;
virtual PPresentationRequestParent*
AllocPPresentationRequestParent(const PresentationIPCRequest& aRequest) override;
virtual bool
DeallocPPresentationRequestParent(PPresentationRequestParent* aActor) override;
virtual PPresentationBuilderParent*
AllocPPresentationBuilderParent(const nsString& aSessionId,
const uint8_t& aRole) override;
virtual bool
DeallocPPresentationBuilderParent(
PPresentationBuilderParent* aActor) override;
virtual bool Recv__delete__() override;
virtual bool RecvRegisterAvailabilityHandler(
nsTArray<nsString>&& aAvailabilityUrls) override;
virtual bool RecvUnregisterAvailabilityHandler(
nsTArray<nsString>&& aAvailabilityUrls) override;
virtual bool RecvRegisterSessionHandler(const nsString& aSessionId,
const uint8_t& aRole) override;
virtual bool RecvUnregisterSessionHandler(const nsString& aSessionId,
const uint8_t& aRole) override;
virtual bool RecvRegisterRespondingHandler(const uint64_t& aWindowId) override;
virtual bool RecvUnregisterRespondingHandler(const uint64_t& aWindowId) override;
virtual bool RecvNotifyReceiverReady(const nsString& aSessionId,
const uint64_t& aWindowId,
const bool& aIsLoading) override;
virtual bool RecvNotifyTransportClosed(const nsString& aSessionId,
const uint8_t& aRole,
const nsresult& aReason) override;
private:
virtual ~PresentationParent();
bool mActorDestroyed = false;
nsCOMPtr<nsIPresentationService> mService;
nsTArray<nsString> mSessionIdsAtController;
nsTArray<nsString> mSessionIdsAtReceiver;
nsTArray<uint64_t> mWindowIds;
ContentParentId mChildId;
nsTArray<nsString> mContentAvailabilityUrls;
};
class PresentationRequestParent final : public PPresentationRequestParent
, public nsIPresentationServiceCallback
{
friend class PresentationParent;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPRESENTATIONSERVICECALLBACK
explicit PresentationRequestParent(nsIPresentationService* aService,
ContentParentId aContentParentId);
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
private:
virtual ~PresentationRequestParent();
nsresult SendResponse(nsresult aResult);
nsresult DoRequest(const StartSessionRequest& aRequest);
nsresult DoRequest(const SendSessionMessageRequest& aRequest);
nsresult DoRequest(const CloseSessionRequest& aRequest);
nsresult DoRequest(const TerminateSessionRequest& aRequest);
nsresult DoRequest(const ReconnectSessionRequest& aRequest);
nsresult DoRequest(const BuildTransportRequest& aRequest);
bool mActorDestroyed = false;
bool mNeedRegisterBuilder = false;
nsString mSessionId;
nsCOMPtr<nsIPresentationService> mService;
ContentParentId mChildId;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_PresentationParent_h__
|