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