PushSubscriptionOptions.h (1658B)
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_PushSubscriptionOptions_h 8 #define mozilla_dom_PushSubscriptionOptions_h 9 10 #include "js/RootingAPI.h" 11 #include "js/TypeDecls.h" 12 #include "mozilla/dom/ServiceWorkerUtils.h" 13 #include "nsCOMPtr.h" 14 #include "nsCycleCollectionParticipant.h" 15 #include "nsTArray.h" 16 #include "nsWrapperCache.h" 17 18 class nsIGlobalObject; 19 20 namespace mozilla { 21 22 class ErrorResult; 23 24 namespace dom { 25 26 class PushSubscriptionOptions final : public nsISupports, 27 public nsWrapperCache { 28 public: 29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushSubscriptionOptions) 31 32 PushSubscriptionOptions(nsIGlobalObject* aGlobal, 33 nsTArray<uint8_t>&& aRawAppServerKey); 34 35 nsIGlobalObject* GetParentObject() const { return mGlobal; } 36 37 JSObject* WrapObject(JSContext* aCx, 38 JS::Handle<JSObject*> aGivenProto) override; 39 40 void GetApplicationServerKey(JSContext* aCx, 41 JS::MutableHandle<JSObject*> aKey, 42 ErrorResult& aRv); 43 44 private: 45 ~PushSubscriptionOptions(); 46 47 nsCOMPtr<nsIGlobalObject> mGlobal; 48 nsTArray<uint8_t> mRawAppServerKey; 49 JS::Heap<JSObject*> mAppServerKey; 50 }; 51 52 } // namespace dom 53 } // namespace mozilla 54 55 #endif // mozilla_dom_PushSubscriptionOptions_h