Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 // Defines a variant of libgps wrapper for use with the 2.94 release of the API. | 5 // Defines a variant of libgps wrapper for use with the 2.94 release of the API. |
| 6 | 6 |
| 7 #include "content/browser/geolocation/libgps_wrapper_linux.h" | 7 #include "content/browser/geolocation/libgps_wrapper_linux.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/common/geoposition.h" | 10 #include "content/common/geoposition.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // This function is duplicated between the library versions, however it | 25 // This function is duplicated between the library versions, however it |
| 26 // cannot be shared as each one must be strictly compiled against the | 26 // cannot be shared as each one must be strictly compiled against the |
| 27 // corresponding version of gps.h. | 27 // corresponding version of gps.h. |
| 28 DCHECK(position); | 28 DCHECK(position); |
| 29 const gps_data_t& gps_data = library().data(); | 29 const gps_data_t& gps_data = library().data(); |
| 30 if (gps_data.status == STATUS_NO_FIX) | 30 if (gps_data.status == STATUS_NO_FIX) |
| 31 return false; | 31 return false; |
| 32 position->latitude = gps_data.fix.latitude; | 32 position->latitude = gps_data.fix.latitude; |
| 33 position->longitude = gps_data.fix.longitude; | 33 position->longitude = gps_data.fix.longitude; |
| 34 position->accuracy = std::max(gps_data.fix.epx, gps_data.fix.epy); | 34 position->accuracy = std::max(gps_data.fix.epx, gps_data.fix.epy); |
| 35 if (position->accuracy != position->accuracy) { | |
|
John Knottenbelt
2011/10/06 16:26:56
Did you mean to include this change in this patch
joth
2011/10/06 19:15:58
Done.
| |
| 36 // TODO(joth): Fixme. This is a workaround for http://crbug.com/99326 | |
| 37 LOG(WARNING) << "libgps reported accuracy NaN, forcing to zero"; | |
| 38 position->accuracy = 0; | |
| 39 } | |
| 35 position->altitude = gps_data.fix.altitude; | 40 position->altitude = gps_data.fix.altitude; |
| 36 position->altitude_accuracy = gps_data.fix.epv; | 41 position->altitude_accuracy = gps_data.fix.epv; |
| 37 position->heading = gps_data.fix.track; | 42 position->heading = gps_data.fix.track; |
| 38 position->speed = gps_data.fix.speed; | 43 position->speed = gps_data.fix.speed; |
| 39 return true; | 44 return true; |
| 40 } | 45 } |
| 41 | 46 |
| 42 private: | 47 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(LibGpsV294); | 48 DISALLOW_COPY_AND_ASSIGN(LibGpsV294); |
| 44 }; | 49 }; |
| 45 | 50 |
| 46 LibGps* LibGps::NewV294(LibGpsLibraryWrapper* dl_wrapper) { | 51 LibGps* LibGps::NewV294(LibGpsLibraryWrapper* dl_wrapper) { |
| 47 return new LibGpsV294(dl_wrapper); | 52 return new LibGpsV294(dl_wrapper); |
| 48 } | 53 } |
| OLD | NEW |