Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_PresentationContentSessionInfo_h
8 : #define mozilla_dom_PresentationContentSessionInfo_h
9 :
10 : #include "nsCOMPtr.h"
11 : #include "nsIPresentationSessionTransport.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : /**
17 : * PresentationContentSessionInfo manages nsIPresentationSessionTransport and
18 : * delegates the callbacks to PresentationIPCService. Only lives in content
19 : * process.
20 : */
21 : class PresentationContentSessionInfo final : public nsIPresentationSessionTransportCallback
22 : {
23 : public:
24 : NS_DECL_ISUPPORTS
25 : NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTCALLBACK
26 :
27 0 : PresentationContentSessionInfo(const nsAString& aSessionId,
28 : uint8_t aRole,
29 : nsIPresentationSessionTransport* aTransport)
30 0 : : mSessionId(aSessionId)
31 : , mRole(aRole)
32 0 : , mTransport(aTransport)
33 : {
34 0 : MOZ_ASSERT(XRE_IsContentProcess());
35 0 : MOZ_ASSERT(!aSessionId.IsEmpty());
36 0 : MOZ_ASSERT(aRole == nsIPresentationService::ROLE_CONTROLLER ||
37 : aRole == nsIPresentationService::ROLE_RECEIVER);
38 0 : MOZ_ASSERT(aTransport);
39 0 : }
40 :
41 : nsresult Init();
42 :
43 : nsresult Send(const nsAString& aData);
44 :
45 : nsresult SendBinaryMsg(const nsACString& aData);
46 :
47 : nsresult SendBlob(nsIDOMBlob* aBlob);
48 :
49 : nsresult Close(nsresult aReason);
50 :
51 : private:
52 0 : virtual ~PresentationContentSessionInfo() {}
53 :
54 : nsString mSessionId;
55 : uint8_t mRole;
56 : nsCOMPtr<nsIPresentationSessionTransport> mTransport;
57 : };
58 :
59 : } // namespace dom
60 : } // namespace mozilla
61 :
62 : #endif // mozilla_dom_PresentationContentSessionInfo_h
|