GeolocationCoordinates.h (1606B)
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_GeolocationCoordinates_h 8 #define mozilla_dom_GeolocationCoordinates_h 9 10 #include "GeolocationPosition.h" 11 #include "js/TypeDecls.h" 12 #include "mozilla/dom/Nullable.h" 13 #include "nsCycleCollectionParticipant.h" 14 #include "nsIDOMGeoPositionCoords.h" 15 #include "nsWrapperCache.h" 16 17 namespace mozilla::dom { 18 19 class GeolocationCoordinates final : public nsISupports, public nsWrapperCache { 20 ~GeolocationCoordinates(); 21 22 public: 23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 24 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GeolocationCoordinates) 25 26 public: 27 GeolocationCoordinates(GeolocationPosition* aPosition, 28 nsIDOMGeoPositionCoords* aCoords); 29 30 GeolocationPosition* GetParentObject() const; 31 32 virtual JSObject* WrapObject(JSContext* aCx, 33 JS::Handle<JSObject*> aGivenProto) override; 34 35 double Latitude() const; 36 37 double Longitude() const; 38 39 Nullable<double> GetAltitude() const; 40 41 double Accuracy() const; 42 43 Nullable<double> GetAltitudeAccuracy() const; 44 45 Nullable<double> GetHeading() const; 46 47 Nullable<double> GetSpeed() const; 48 49 private: 50 RefPtr<GeolocationPosition> mPosition; 51 nsCOMPtr<nsIDOMGeoPositionCoords> mCoords; 52 }; 53 54 } // namespace mozilla::dom 55 56 #endif /* mozilla_dom_GeolocationCoordinates_h */