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

Side by Side Diff: content/browser/geolocation/libgps_2_94_wrapper_linux.cc

Issue 6597044: Revert 76228 - Move core pieces of geolocation from chrome to content.This is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 months 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
OLDNEW
(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 // Defines a variant of libgps wrapper for use with the 2.94 release of the API.
6
7 #include "content/browser/geolocation/libgps_wrapper_linux.h"
8
9 #include "base/logging.h"
10 #include "chrome/common/geoposition.h"
11 #include "third_party/gpsd/release-2.94/gps.h"
12
13 class LibGpsV294 : public LibGps {
14 public:
15 explicit LibGpsV294(LibGpsLibraryWrapper* dl_wrapper) : LibGps(dl_wrapper) {}
16
17 // LibGps
18 virtual bool StartStreaming() {
19 return library().stream(WATCH_ENABLE) == 0;
20 }
21 virtual bool DataWaiting() {
22 return library().waiting();
23 }
24 virtual bool GetPositionIfFixed(Geoposition* position) {
25 // This function is duplicated between the library versions, however it
26 // cannot be shared as each one must be strictly compiled against the
27 // corresponding version of gps.h.
28 DCHECK(position);
29 const gps_data_t& gps_data = library().data();
30 if (gps_data.status == STATUS_NO_FIX)
31 return false;
32 position->latitude = gps_data.fix.latitude;
33 position->longitude = gps_data.fix.longitude;
34 position->accuracy = std::max(gps_data.fix.epx, gps_data.fix.epy);
35 position->altitude = gps_data.fix.altitude;
36 position->altitude_accuracy = gps_data.fix.epv;
37 position->heading = gps_data.fix.track;
38 position->speed = gps_data.fix.speed;
39 return true;
40 }
41
42 private:
43 DISALLOW_COPY_AND_ASSIGN(LibGpsV294);
44 };
45
46 LibGps* LibGps::NewV294(LibGpsLibraryWrapper* dl_wrapper) {
47 return new LibGpsV294(dl_wrapper);
48 }
OLDNEW
« no previous file with comments | « content/browser/geolocation/libgps_2_38_wrapper_linux.cc ('k') | content/browser/geolocation/libgps_wrapper_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698