Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this
3 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef mozilla_dom_PushSubscriptionOptions_h
6 : #define mozilla_dom_PushSubscriptionOptions_h
7 :
8 : #include "nsCycleCollectionParticipant.h"
9 : #include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
10 : #include "nsTArray.h"
11 : #include "nsWrapperCache.h"
12 :
13 : class nsIGlobalObject;
14 :
15 : namespace mozilla {
16 :
17 : class ErrorResult;
18 :
19 : namespace dom {
20 :
21 : class PushSubscriptionOptions final : public nsISupports
22 : , public nsWrapperCache
23 : {
24 : public:
25 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
26 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushSubscriptionOptions)
27 :
28 : PushSubscriptionOptions(nsIGlobalObject* aGlobal,
29 : nsTArray<uint8_t>&& aRawAppServerKey);
30 :
31 : nsIGlobalObject*
32 0 : GetParentObject() const
33 : {
34 0 : return mGlobal;
35 : }
36 :
37 : JSObject*
38 : WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
39 :
40 : void
41 : GetApplicationServerKey(JSContext* aCx,
42 : JS::MutableHandle<JSObject*> aKey,
43 : ErrorResult& aRv);
44 :
45 : private:
46 : ~PushSubscriptionOptions();
47 :
48 : nsCOMPtr<nsIGlobalObject> mGlobal;
49 : nsTArray<uint8_t> mRawAppServerKey;
50 : JS::Heap<JSObject*> mAppServerKey;
51 : };
52 :
53 : } // namespace dom
54 : } // namespace mozilla
55 :
56 : #endif // mozilla_dom_PushSubscriptionOptions_h
|