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 // This file declares GPS providers that run on linux. Currently, just uses | 5 // This file declares GPS providers that run on linux. Currently, just uses |
6 // the libgps (gpsd) API. Public for testing only - for normal usage this | 6 // the libgps (gpsd) API. Public for testing only - for normal usage this |
7 // header should not be required, as location_provider.h declares the needed | 7 // header should not be required, as location_provider.h declares the needed |
8 // factory function. | 8 // factory function. |
9 | 9 |
10 #ifndef CONTENT_BROWSER_GEOLOCATION_GPS_LOCATION_PROVIDER_LINUX_H_ | 10 #ifndef CONTENT_BROWSER_GEOLOCATION_GPS_LOCATION_PROVIDER_LINUX_H_ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 scoped_ptr<gps_data_t> gps_data_; | 50 scoped_ptr<gps_data_t> gps_data_; |
51 bool is_open_; | 51 bool is_open_; |
52 #endif // defined(USE_LIBGPS) | 52 #endif // defined(USE_LIBGPS) |
53 | 53 |
54 private: | 54 private: |
55 DISALLOW_COPY_AND_ASSIGN(LibGps); | 55 DISALLOW_COPY_AND_ASSIGN(LibGps); |
56 }; | 56 }; |
57 | 57 |
58 // Location provider for Linux, that uses libgps/gpsd to obtain position fixes. | 58 // Location provider for Linux, that uses libgps/gpsd to obtain position fixes. |
59 // TODO(joth): Currently this runs entirely in the client thread (i.e. Chrome's | |
60 // IO thread). As the older libgps API is not designed to support polling, | |
61 // there's a chance it could block, so better move this into its own worker | |
62 // thread. | |
63 class CONTENT_EXPORT GpsLocationProviderLinux : public LocationProviderBase { | 59 class CONTENT_EXPORT GpsLocationProviderLinux : public LocationProviderBase { |
64 public: | 60 public: |
65 typedef LibGps* (*LibGpsFactory)(); | 61 typedef LibGps* (*LibGpsFactory)(); |
66 // |factory| will be used to create the gpsd client library wrapper. (Note | 62 // |factory| will be used to create the gpsd client library wrapper. (Note |
67 // NewSystemLocationProvider() will use the default factory). | 63 // NewSystemLocationProvider() will use the default factory). |
68 explicit GpsLocationProviderLinux(LibGpsFactory libgps_factory); | 64 explicit GpsLocationProviderLinux(LibGpsFactory libgps_factory); |
69 virtual ~GpsLocationProviderLinux(); | 65 virtual ~GpsLocationProviderLinux(); |
70 | 66 |
71 void SetGpsdReconnectIntervalMillis(int value) { | 67 void SetGpsdReconnectIntervalMillis(int value) { |
72 gpsd_reconnect_interval_millis_ = value; | 68 gpsd_reconnect_interval_millis_ = value; |
(...skipping 27 matching lines...) Expand all Loading... |
100 scoped_ptr<LibGps> gps_; | 96 scoped_ptr<LibGps> gps_; |
101 Geoposition position_; | 97 Geoposition position_; |
102 | 98 |
103 // Holder for the tasks which run on the thread; takes care of cleanup. | 99 // Holder for the tasks which run on the thread; takes care of cleanup. |
104 base::WeakPtrFactory<GpsLocationProviderLinux> weak_factory_; | 100 base::WeakPtrFactory<GpsLocationProviderLinux> weak_factory_; |
105 }; | 101 }; |
106 | 102 |
107 } // namespace content | 103 } // namespace content |
108 | 104 |
109 #endif // CONTENT_BROWSER_GEOLOCATION_GPS_LOCATION_PROVIDER_LINUX_H_ | 105 #endif // CONTENT_BROWSER_GEOLOCATION_GPS_LOCATION_PROVIDER_LINUX_H_ |
OLD | NEW |