Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: content/browser/geolocation/gps_location_provider_linux.h

Issue 8463022: Make chrome communicate with gpsd through libgps/shared memory (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: putting libgps version string into anon namespace Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/geolocation/gps_location_provider_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 15 matching lines...) Expand all
26 // there's a chance it could block, so better move this into its own worker 26 // there's a chance it could block, so better move this into its own worker
27 // thread. 27 // thread.
28 class CONTENT_EXPORT GpsLocationProviderLinux : public LocationProviderBase { 28 class CONTENT_EXPORT GpsLocationProviderLinux : public LocationProviderBase {
29 public: 29 public:
30 typedef LibGps* (*LibGpsFactory)(); 30 typedef LibGps* (*LibGpsFactory)();
31 // |factory| will be used to create the gpsd client library wrapper. (Note 31 // |factory| will be used to create the gpsd client library wrapper. (Note
32 // NewSystemLocationProvider() will use the default factory). 32 // NewSystemLocationProvider() will use the default factory).
33 explicit GpsLocationProviderLinux(LibGpsFactory libgps_factory); 33 explicit GpsLocationProviderLinux(LibGpsFactory libgps_factory);
34 virtual ~GpsLocationProviderLinux(); 34 virtual ~GpsLocationProviderLinux();
35 35
36 void SetGpsdReconnectIntervalMillis(int value) {
37 gpsd_reconnect_interval_millis_ = value;
38 }
39 void SetPollPeriodMovingMillis(int value) {
40 poll_period_moving_millis_ = value;
41 }
42 void SetPollPeriodStationaryMillis(int value) {
43 poll_period_stationary_millis_ = value;
44 }
45
36 // LocationProvider 46 // LocationProvider
37 virtual bool StartProvider(bool high_accuracy); 47 virtual bool StartProvider(bool high_accuracy);
38 virtual void StopProvider(); 48 virtual void StopProvider();
39 virtual void GetPosition(Geoposition* position); 49 virtual void GetPosition(Geoposition* position);
40 virtual void UpdatePosition(); 50 virtual void UpdatePosition();
41 virtual void OnPermissionGranted(const GURL& requesting_frame); 51 virtual void OnPermissionGranted(const GURL& requesting_frame);
42 52
43 private: 53 private:
44 // Task which run in the child thread. 54 // Task which run in the child thread.
45 void DoGpsPollTask(); 55 void DoGpsPollTask();
46 56
47 // Will schedule a poll; i.e. enqueue DoGpsPollTask deferred task. 57 // Will schedule a poll; i.e. enqueue DoGpsPollTask deferred task.
48 void ScheduleNextGpsPoll(int interval); 58 void ScheduleNextGpsPoll(int interval);
49 59
60 int gpsd_reconnect_interval_millis_;
61 int poll_period_moving_millis_;
62 int poll_period_stationary_millis_;
63
50 const LibGpsFactory libgps_factory_; 64 const LibGpsFactory libgps_factory_;
51 scoped_ptr<LibGps> gps_; 65 scoped_ptr<LibGps> gps_;
52 Geoposition position_; 66 Geoposition position_;
53 67
54 // Holder for the tasks which run on the thread; takes care of cleanup. 68 // Holder for the tasks which run on the thread; takes care of cleanup.
55 base::WeakPtrFactory<GpsLocationProviderLinux> weak_factory_; 69 base::WeakPtrFactory<GpsLocationProviderLinux> weak_factory_;
56 }; 70 };
57 71
58 #endif // CONTENT_BROWSER_GEOLOCATION_GPS_LOCATION_PROVIDER_LINUX_H_ 72 #endif // CONTENT_BROWSER_GEOLOCATION_GPS_LOCATION_PROVIDER_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/geolocation/gps_location_provider_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698