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