Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: webkit/chaos/ChaosGeolocation.h

Issue 160084: Chaos geolocation demo, non-WebKit part. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/chaos/ChaosCoordinates.idl ('k') | webkit/chaos/ChaosGeolocation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/chaos/ChaosGeolocation.h
===================================================================
--- webkit/chaos/ChaosGeolocation.h (revision 0)
+++ webkit/chaos/ChaosGeolocation.h (revision 0)
@@ -0,0 +1,81 @@
+#ifndef ChaosGeolocation_h
+#define ChaosGeolocation_h
+
+#include "ChaosPositionCallback.h"
+#include "PositionErrorCallback.h"
+#include "Timer.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+#include <string>
+
+namespace WebCore {
+
+class ChaosCoordinates;
+class ChaosPositionCallback;
+class ChaosGeoposition;
+class PositionErrorCallback;
+
+class ChaosGeolocationImpl {
+ public:
+ virtual ChaosCoordinates *coords() const = 0;
+ virtual std::string describe() const = 0;
+};
+
+class ChaosGeolocation : public RefCounted<ChaosGeolocation> {
+ public:
+ ChaosGeolocation();
+ // ChaosCoordinates *coords();
+ ChaosGeoposition *lastPosition();
+ void getCurrentPosition(PassRefPtr<ChaosPositionCallback>/*,
+ PassRefPtr<PositionErrorCallback>,
+ PassRefPtr<PositionOptions>*/);
+ int watchPosition(PassRefPtr<ChaosPositionCallback>/*,
+ PassRefPtr<PositionErrorCallback>,
+ PassRefPtr<PositionOptions>*/);
+ void clearWatch(long watchId);
+
+ // For the powerbox
+ // Called when the user chooses an implementation
+ void OnProviderChosen(ChaosGeolocationImpl *impl);
+
+ private:
+
+ class GeoNotifier : public RefCounted<GeoNotifier> {
+ public:
+ static PassRefPtr<GeoNotifier>
+ create(ChaosGeolocation *parent,
+ PassRefPtr<ChaosPositionCallback> positionCallback/*,
+ PassRefPtr<PositionErrorCallback> positionErrorCallback*/) {
+ return adoptRef(new GeoNotifier(parent, positionCallback/*,
+ positionErrorCallback*/));
+ }
+
+ void startTimer();
+ void timerFired(Timer<GeoNotifier> *);
+
+ private:
+ GeoNotifier(ChaosGeolocation *parent, PassRefPtr<ChaosPositionCallback>/*,
+ PassRefPtr<PositionErrorCallback>*/);
+
+ RefPtr<ChaosPositionCallback> successCallback_;
+ //RefPtr<PositionErrorCallback> errorCallback_;
+ // RefPtr<PositionOptions> m_options;
+ Timer<GeoNotifier> timer_;
+ ChaosGeolocation *parent_;
+ };
+
+ typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet;
+ typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap;
+
+ GeoNotifierSet oneShots_;
+ GeoNotifierMap watchers_;
+
+ ChaosGeolocationImpl *impl_;
+};
+
+} // namespace WebCore
+
+#endif // ChaosGeolocation_h
Property changes on: webkit/chaos/ChaosGeolocation.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « webkit/chaos/ChaosCoordinates.idl ('k') | webkit/chaos/ChaosGeolocation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698