| OLD | NEW |
| (Empty) | |
| 1 #ifndef ChaosGeolocation_h |
| 2 #define ChaosGeolocation_h |
| 3 |
| 4 #include "ChaosPositionCallback.h" |
| 5 #include "PositionErrorCallback.h" |
| 6 #include "Timer.h" |
| 7 #include <wtf/HashMap.h> |
| 8 #include <wtf/HashSet.h> |
| 9 #include <wtf/PassRefPtr.h> |
| 10 #include <wtf/RefCounted.h> |
| 11 |
| 12 #include <string> |
| 13 |
| 14 namespace WebCore { |
| 15 |
| 16 class ChaosCoordinates; |
| 17 class ChaosPositionCallback; |
| 18 class ChaosGeoposition; |
| 19 class PositionErrorCallback; |
| 20 |
| 21 class ChaosGeolocationImpl { |
| 22 public: |
| 23 virtual ChaosCoordinates *coords() const = 0; |
| 24 virtual std::string describe() const = 0; |
| 25 }; |
| 26 |
| 27 class ChaosGeolocation : public RefCounted<ChaosGeolocation> { |
| 28 public: |
| 29 ChaosGeolocation(); |
| 30 // ChaosCoordinates *coords(); |
| 31 ChaosGeoposition *lastPosition(); |
| 32 void getCurrentPosition(PassRefPtr<ChaosPositionCallback>/*, |
| 33 PassRefPtr<PositionErrorCallback>, |
| 34 PassRefPtr<PositionOptions>*/); |
| 35 int watchPosition(PassRefPtr<ChaosPositionCallback>/*, |
| 36 PassRefPtr<PositionErrorCallback>, |
| 37 PassRefPtr<PositionOptions>*/); |
| 38 void clearWatch(long watchId); |
| 39 private: |
| 40 |
| 41 class GeoNotifier : public RefCounted<GeoNotifier> { |
| 42 public: |
| 43 static PassRefPtr<GeoNotifier> |
| 44 create(PassRefPtr<ChaosPositionCallback> positionCallback/*, |
| 45 PassRefPtr<PositionErrorCallback> positionErrorCallback*/) { |
| 46 return adoptRef(new GeoNotifier(positionCallback/*, |
| 47 positionErrorCallback*/)); |
| 48 } |
| 49 |
| 50 void startTimer(); |
| 51 void timerFired(Timer<GeoNotifier>*); |
| 52 |
| 53 RefPtr<ChaosPositionCallback> successCallback_; |
| 54 //RefPtr<PositionErrorCallback> errorCallback_; |
| 55 // RefPtr<PositionOptions> m_options; |
| 56 Timer<GeoNotifier> timer_; |
| 57 |
| 58 private: |
| 59 GeoNotifier(PassRefPtr<ChaosPositionCallback>/*, |
| 60 PassRefPtr<PositionErrorCallback>*/); |
| 61 }; |
| 62 |
| 63 typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet; |
| 64 typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap; |
| 65 |
| 66 GeoNotifierSet oneShots_; |
| 67 GeoNotifierMap watchers_; |
| 68 |
| 69 ChaosGeolocationImpl *impl_; |
| 70 }; |
| 71 |
| 72 } // namespace WebCore |
| 73 |
| 74 #endif // ChaosGeolocation_h |
| OLD | NEW |