Bug 1732409 let fake:true getUserMedia() parameter override loopback prefs r=jib
[gecko.git] / dom / geolocation / GeolocationPosition.h
blobae7a267955c63778a09f240ffa0a256b4978c9f1
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"
12 #include "nsString.h"
13 #include "nsCOMPtr.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 ////////////////////////////////////////////////////
24 /**
25 * Simple object that holds a single point in space.
27 class nsGeoPositionCoords final : public nsIDOMGeoPositionCoords {
28 public:
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);
35 private:
36 ~nsGeoPositionCoords();
37 const double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
40 ////////////////////////////////////////////////////
41 // nsGeoPosition
42 ////////////////////////////////////////////////////
44 class nsGeoPosition final : public nsIDOMGeoPosition {
45 public:
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);
55 private:
56 ~nsGeoPosition();
57 EpochTimeStamp mTimestamp;
58 RefPtr<nsIDOMGeoPositionCoords> mCoords;
61 ////////////////////////////////////////////////////
62 // WebIDL wrappers for the classes above
63 ////////////////////////////////////////////////////
65 namespace mozilla {
66 namespace dom {
68 class GeolocationCoordinates;
70 class GeolocationPosition final : public nsISupports, public nsWrapperCache {
71 ~GeolocationPosition();
73 public:
74 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
75 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GeolocationPosition)
77 public:
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; }
91 private:
92 RefPtr<GeolocationCoordinates> mCoordinates;
93 nsCOMPtr<nsISupports> mParent;
94 nsCOMPtr<nsIDOMGeoPosition> mGeoPosition;
97 } // namespace dom
98 } // namespace mozilla
100 #endif /* mozilla_dom_GeolocationPosition_h */