GeolocationPositionError.h (1634B)
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_GeolocationPositionError_h 8 #define mozilla_dom_GeolocationPositionError_h 9 10 #include "mozilla/dom/CallbackObject.h" 11 #include "nsCycleCollectionParticipant.h" 12 #include "nsISupportsImpl.h" 13 #include "nsWrapperCache.h" 14 15 class nsIDOMGeoPositionErrorCallback; 16 17 namespace mozilla::dom { 18 class PositionErrorCallback; 19 class Geolocation; 20 typedef CallbackObjectHolder<PositionErrorCallback, 21 nsIDOMGeoPositionErrorCallback> 22 GeoPositionErrorCallback; 23 24 class GeolocationPositionError final : public nsWrapperCache { 25 public: 26 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(GeolocationPositionError) 27 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(GeolocationPositionError) 28 29 GeolocationPositionError(Geolocation* aParent, int16_t aCode); 30 31 nsWrapperCache* GetParentObject() const; 32 33 virtual JSObject* WrapObject(JSContext* aCx, 34 JS::Handle<JSObject*> aGivenProto) override; 35 36 int16_t Code() const { return mCode; } 37 38 void GetMessage(nsAString& aMessage) const; 39 40 MOZ_CAN_RUN_SCRIPT 41 void NotifyCallback(const GeoPositionErrorCallback& callback); 42 43 private: 44 ~GeolocationPositionError(); 45 int16_t mCode; 46 RefPtr<Geolocation> mParent; 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif /* mozilla_dom_GeolocationPositionError_h */