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_GeolocationPosition_h
8 #define mozilla_dom_GeolocationPosition_h
10 #include "nsIDOMGeoPositionCoords.h"
11 #include "nsIDOMGeoPosition.h"
14 #include "mozilla/Attributes.h"
15 #include "nsCycleCollectionParticipant.h"
16 #include "nsWrapperCache.h"
17 #include "mozilla/dom/Nullable.h"
18 #include "js/TypeDecls.h"
20 ////////////////////////////////////////////////////
21 // nsGeoPositionCoords
22 ////////////////////////////////////////////////////
25 * Simple object that holds a single point in space.
27 class nsGeoPositionCoords final
: public nsIDOMGeoPositionCoords
{
29 NS_DECL_THREADSAFE_ISUPPORTS
30 NS_DECL_NSIDOMGEOPOSITIONCOORDS
32 nsGeoPositionCoords(double aLat
, double aLong
, double aAlt
, double aHError
,
33 double aVError
, double aHeading
, double aSpeed
);
36 ~nsGeoPositionCoords();
37 const double mLat
, mLong
, mAlt
, mHError
, mVError
, mHeading
, mSpeed
;
40 ////////////////////////////////////////////////////
42 ////////////////////////////////////////////////////
44 class nsGeoPosition final
: public nsIDOMGeoPosition
{
46 NS_DECL_THREADSAFE_ISUPPORTS
47 NS_DECL_NSIDOMGEOPOSITION
49 nsGeoPosition(double aLat
, double aLong
, double aAlt
, double aHError
,
50 double aVError
, double aHeading
, double aSpeed
,
51 EpochTimeStamp aTimestamp
);
53 nsGeoPosition(nsIDOMGeoPositionCoords
* aCoords
, EpochTimeStamp aTimestamp
);
57 EpochTimeStamp mTimestamp
;
58 RefPtr
<nsIDOMGeoPositionCoords
> mCoords
;
61 ////////////////////////////////////////////////////
62 // WebIDL wrappers for the classes above
63 ////////////////////////////////////////////////////
68 class GeolocationCoordinates
;
70 class GeolocationPosition final
: public nsISupports
, public nsWrapperCache
{
71 ~GeolocationPosition();
74 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
75 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GeolocationPosition
)
78 GeolocationPosition(nsISupports
* aParent
, nsIDOMGeoPosition
* aGeoPosition
);
80 nsISupports
* GetParentObject() const;
82 virtual JSObject
* WrapObject(JSContext
* aCx
,
83 JS::Handle
<JSObject
*> aGivenProto
) override
;
85 GeolocationCoordinates
* Coords();
87 uint64_t Timestamp() const;
89 nsIDOMGeoPosition
* GetWrappedGeoPosition() { return mGeoPosition
; }
92 RefPtr
<GeolocationCoordinates
> mCoordinates
;
93 nsCOMPtr
<nsISupports
> mParent
;
94 nsCOMPtr
<nsIDOMGeoPosition
> mGeoPosition
;
98 } // namespace mozilla
100 #endif /* mozilla_dom_GeolocationPosition_h */