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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/chaos/ChaosCoordinates.idl ('k') | webkit/chaos/ChaosGeolocation.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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
40 // For the powerbox
41 // Called when the user chooses an implementation
42 void OnProviderChosen(ChaosGeolocationImpl *impl);
43
44 private:
45
46 class GeoNotifier : public RefCounted<GeoNotifier> {
47 public:
48 static PassRefPtr<GeoNotifier>
49 create(ChaosGeolocation *parent,
50 PassRefPtr<ChaosPositionCallback> positionCallback/*,
51 PassRefPtr<PositionErrorCallback> positionErrorCallback*/) {
52 return adoptRef(new GeoNotifier(parent, positionCallback/*,
53 positionErrorCallback*/));
54 }
55
56 void startTimer();
57 void timerFired(Timer<GeoNotifier> *);
58
59 private:
60 GeoNotifier(ChaosGeolocation *parent, PassRefPtr<ChaosPositionCallback>/*,
61 PassRefPtr<PositionErrorCallback>*/);
62
63 RefPtr<ChaosPositionCallback> successCallback_;
64 //RefPtr<PositionErrorCallback> errorCallback_;
65 // RefPtr<PositionOptions> m_options;
66 Timer<GeoNotifier> timer_;
67 ChaosGeolocation *parent_;
68 };
69
70 typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet;
71 typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap;
72
73 GeoNotifierSet oneShots_;
74 GeoNotifierMap watchers_;
75
76 ChaosGeolocationImpl *impl_;
77 };
78
79 } // namespace WebCore
80
81 #endif // ChaosGeolocation_h
OLDNEW
« 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