Backed out 2 changesets (bug 1900622) for causing Bug 1908553 and ktlint failure...
[gecko.git] / dom / geolocation / GeolocationPosition.h
blob87b883a69ea8cb7337a229eff5a53feb0e963b8a
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 "nsCOMPtr.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "nsWrapperCache.h"
15 #include "js/TypeDecls.h"
17 ////////////////////////////////////////////////////
18 // nsGeoPositionCoords
19 ////////////////////////////////////////////////////
21 /**
22 * Simple object that holds a single point in space.
24 class nsGeoPositionCoords final : public nsIDOMGeoPositionCoords {
25 public:
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSIDOMGEOPOSITIONCOORDS
29 nsGeoPositionCoords(double aLat, double aLong, double aAlt, double aHError,
30 double aVError, double aHeading, double aSpeed);
32 private:
33 ~nsGeoPositionCoords();
34 const double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
37 ////////////////////////////////////////////////////
38 // nsGeoPosition
39 ////////////////////////////////////////////////////
41 class nsGeoPosition final : public nsIDOMGeoPosition {
42 public:
43 NS_DECL_THREADSAFE_ISUPPORTS
44 NS_DECL_NSIDOMGEOPOSITION
46 nsGeoPosition(double aLat, double aLong, double aAlt, double aHError,
47 double aVError, double aHeading, double aSpeed,
48 EpochTimeStamp aTimestamp);
50 nsGeoPosition(nsIDOMGeoPositionCoords* aCoords, EpochTimeStamp aTimestamp);
52 private:
53 ~nsGeoPosition();
54 EpochTimeStamp mTimestamp;
55 RefPtr<nsIDOMGeoPositionCoords> mCoords;
58 ////////////////////////////////////////////////////
59 // WebIDL wrappers for the classes above
60 ////////////////////////////////////////////////////
62 namespace mozilla::dom {
64 class GeolocationCoordinates;
66 class GeolocationPosition final : public nsISupports, public nsWrapperCache {
67 ~GeolocationPosition();
69 public:
70 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
71 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GeolocationPosition)
73 public:
74 GeolocationPosition(nsISupports* aParent, nsIDOMGeoPosition* aGeoPosition);
76 nsISupports* GetParentObject() const;
78 virtual JSObject* WrapObject(JSContext* aCx,
79 JS::Handle<JSObject*> aGivenProto) override;
81 GeolocationCoordinates* Coords();
83 uint64_t Timestamp() const;
85 nsIDOMGeoPosition* GetWrappedGeoPosition() { return mGeoPosition; }
87 private:
88 RefPtr<GeolocationCoordinates> mCoordinates;
89 nsCOMPtr<nsISupports> mParent;
90 nsCOMPtr<nsIDOMGeoPosition> mGeoPosition;
93 } // namespace mozilla::dom
95 #endif /* mozilla_dom_GeolocationPosition_h */