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