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/. */
7 #ifndef mozilla_dom_GeolocationCoordinates_h
8 #define mozilla_dom_GeolocationCoordinates_h
10 #include "nsIDOMGeoPositionCoords.h"
11 #include "GeolocationPosition.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/Nullable.h"
15 #include "js/TypeDecls.h"
17 namespace mozilla::dom
{
19 class GeolocationCoordinates final
: public nsISupports
, public nsWrapperCache
{
20 ~GeolocationCoordinates();
23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
24 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GeolocationCoordinates
)
27 GeolocationCoordinates(GeolocationPosition
* aPosition
,
28 nsIDOMGeoPositionCoords
* aCoords
);
30 GeolocationPosition
* GetParentObject() const;
32 virtual JSObject
* WrapObject(JSContext
* aCx
,
33 JS::Handle
<JSObject
*> aGivenProto
) override
;
35 double Latitude() const;
37 double Longitude() const;
39 Nullable
<double> GetAltitude() const;
41 double Accuracy() const;
43 Nullable
<double> GetAltitudeAccuracy() const;
45 Nullable
<double> GetHeading() const;
47 Nullable
<double> GetSpeed() const;
50 RefPtr
<GeolocationPosition
> mPosition
;
51 nsCOMPtr
<nsIDOMGeoPositionCoords
> mCoords
;
54 } // namespace mozilla::dom
56 #endif /* mozilla_dom_GeolocationCoordinates_h */