OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_PROVIDER_WIN_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_PROVIDER_WIN_H_ |
6 #define CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_PROVIDER_WIN_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_PROVIDER_WIN_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "content/browser/geolocation/location_provider.h" | 11 #include "content/browser/geolocation/location_provider.h" |
12 #include "content/browser/geolocation/win7_location_api_win.h" | 12 #include "content/browser/geolocation/win7_location_api_win.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "content/common/geoposition.h" | 14 #include "content/public/common/geoposition.h" |
15 | 15 |
16 // Location provider for Windows 7 that uses the Location and Sensors platform | 16 // Location provider for Windows 7 that uses the Location and Sensors platform |
17 // to obtain position fixes. | 17 // to obtain position fixes. |
18 // TODO(allanwoj): Remove polling and let the api signal when a new location. | 18 // TODO(allanwoj): Remove polling and let the api signal when a new location. |
19 // TODO(allanwoj): Possibly derive this class and the linux gps provider class | 19 // TODO(allanwoj): Possibly derive this class and the linux gps provider class |
20 // from a single SystemLocationProvider class as their implementation is very | 20 // from a single SystemLocationProvider class as their implementation is very |
21 // similar. | 21 // similar. |
22 class CONTENT_EXPORT Win7LocationProvider : public LocationProviderBase { | 22 class CONTENT_EXPORT Win7LocationProvider : public LocationProviderBase { |
23 public: | 23 public: |
24 Win7LocationProvider(Win7LocationApi* api); | 24 Win7LocationProvider(Win7LocationApi* api); |
25 virtual ~Win7LocationProvider(); | 25 virtual ~Win7LocationProvider(); |
26 | 26 |
27 // LocationProvider. | 27 // LocationProvider. |
28 virtual bool StartProvider(bool high_accuracy) OVERRIDE; | 28 virtual bool StartProvider(bool high_accuracy) OVERRIDE; |
29 virtual void StopProvider() OVERRIDE; | 29 virtual void StopProvider() OVERRIDE; |
30 virtual void GetPosition(Geoposition* position) OVERRIDE; | 30 virtual void GetPosition(content::Geoposition* position) OVERRIDE; |
31 virtual void UpdatePosition() OVERRIDE; | 31 virtual void UpdatePosition() OVERRIDE; |
32 | 32 |
33 private: | 33 private: |
34 // Task which runs in the child thread. | 34 // Task which runs in the child thread. |
35 void DoPollTask(); | 35 void DoPollTask(); |
36 // Will schedule a poll; i.e. enqueue DoPollTask deferred task. | 36 // Will schedule a poll; i.e. enqueue DoPollTask deferred task. |
37 void ScheduleNextPoll(int interval); | 37 void ScheduleNextPoll(int interval); |
38 | 38 |
39 scoped_ptr<Win7LocationApi> api_; | 39 scoped_ptr<Win7LocationApi> api_; |
40 Geoposition position_; | 40 content::Geoposition position_; |
41 // Holder for the tasks which run on the thread; takes care of cleanup. | 41 // Holder for the tasks which run on the thread; takes care of cleanup. |
42 base::WeakPtrFactory<Win7LocationProvider> weak_factory_; | 42 base::WeakPtrFactory<Win7LocationProvider> weak_factory_; |
43 }; | 43 }; |
44 | 44 |
45 #endif // CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_PROVIDER_WIN_H_ | 45 #endif // CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_PROVIDER_WIN_H_ |
OLD | NEW |