Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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_Presentation_h
8 : #define mozilla_dom_Presentation_h
9 :
10 : #include "nsCOMPtr.h"
11 : #include "nsCycleCollectionParticipant.h"
12 : #include "nsISupportsImpl.h"
13 : #include "nsWrapperCache.h"
14 :
15 : class nsPIDOMWindowInner;
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : class Promise;
21 : class PresentationReceiver;
22 : class PresentationRequest;
23 :
24 : class Presentation final : public nsISupports
25 : , public nsWrapperCache
26 : {
27 : public:
28 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Presentation)
30 :
31 : static already_AddRefed<Presentation> Create(nsPIDOMWindowInner* aWindow);
32 :
33 : virtual JSObject* WrapObject(JSContext* aCx,
34 : JS::Handle<JSObject*> aGivenProto) override;
35 :
36 0 : nsPIDOMWindowInner* GetParentObject() const
37 : {
38 0 : return mWindow;
39 : }
40 :
41 : // WebIDL (public APIs)
42 : void SetDefaultRequest(PresentationRequest* aRequest);
43 :
44 : already_AddRefed<PresentationRequest> GetDefaultRequest() const;
45 :
46 : already_AddRefed<PresentationReceiver> GetReceiver();
47 :
48 : // For bookkeeping unsettled start session request
49 : void SetStartSessionUnsettled(bool aIsUnsettled);
50 : bool IsStartSessionUnsettled() const;
51 :
52 : private:
53 : explicit Presentation(nsPIDOMWindowInner* aWindow);
54 :
55 : virtual ~Presentation();
56 :
57 : bool HasReceiverSupport() const;
58 :
59 : bool IsInPresentedContent() const;
60 :
61 : RefPtr<PresentationRequest> mDefaultRequest;
62 : RefPtr<PresentationReceiver> mReceiver;
63 : nsCOMPtr<nsPIDOMWindowInner> mWindow;
64 : bool mStartSessionUnsettled = false;
65 : };
66 :
67 : } // namespace dom
68 : } // namespace mozilla
69 :
70 : #endif // mozilla_dom_Presentation_h
|