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

Unified Diff: content/browser/geolocation/gps_location_provider_linux.cc

Issue 10316007: Make the Geoposition helper class public (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix forward-declaration of struct as class. Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/gps_location_provider_linux.cc
diff --git a/content/browser/geolocation/gps_location_provider_linux.cc b/content/browser/geolocation/gps_location_provider_linux.cc
index e5103fac5eeea3687b1da5e63c842825768f9007..2adeced4c76fc9f08b65ac618fa253b8b45f59bb 100644
--- a/content/browser/geolocation/gps_location_provider_linux.cc
+++ b/content/browser/geolocation/gps_location_provider_linux.cc
@@ -26,13 +26,13 @@ const int kMovementThresholdMeters = 20;
// The arbitrary delta is decreased (Gears used 100 meters); if we need to
// decrease it any further we'll likely want to do some smarter filtering to
// remove GPS location jitter noise.
-bool PositionsDifferSiginificantly(const Geoposition& position_1,
- const Geoposition& position_2) {
- const bool pos_1_valid = position_1.IsValidFix();
- if (pos_1_valid != position_2.IsValidFix())
+bool PositionsDifferSiginificantly(const content::Geoposition& position_1,
+ const content::Geoposition& position_2) {
+ const bool pos_1_valid = position_1.Validate();
+ if (pos_1_valid != position_2.Validate())
return true;
if (!pos_1_valid) {
- DCHECK(!position_2.IsValidFix());
+ DCHECK(!position_2.Validate());
return false;
}
double delta = std::sqrt(
@@ -66,7 +66,7 @@ bool GpsLocationProviderLinux::StartProvider(bool high_accuracy) {
DCHECK(weak_factory_.HasWeakPtrs());
return true;
}
- position_.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
+ position_.error_code = content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
gps_.reset(libgps_factory_());
if (gps_ == NULL) {
DLOG(WARNING) << "libgps could not be loaded";
@@ -81,10 +81,11 @@ void GpsLocationProviderLinux::StopProvider() {
gps_.reset();
}
-void GpsLocationProviderLinux::GetPosition(Geoposition* position) {
+void GpsLocationProviderLinux::GetPosition(content::Geoposition* position) {
DCHECK(position);
*position = position_;
- DCHECK(position->IsInitialized());
+ DCHECK(position->Validate() ||
+ position->error_code != content::Geoposition::ERROR_CODE_NONE);
}
void GpsLocationProviderLinux::UpdatePosition() {
@@ -98,17 +99,19 @@ void GpsLocationProviderLinux::DoGpsPollTask() {
return;
}
- Geoposition new_position;
+ content::Geoposition new_position;
if (!gps_->Read(&new_position)) {
ScheduleNextGpsPoll(poll_period_stationary_millis_);
return;
}
- DCHECK(new_position.IsInitialized());
+ DCHECK(new_position.Validate() ||
+ new_position.error_code != content::Geoposition::ERROR_CODE_NONE);
const bool differ = PositionsDifferSiginificantly(position_, new_position);
ScheduleNextGpsPoll(differ ? poll_period_moving_millis_ :
poll_period_stationary_millis_);
- if (differ || new_position.error_code != Geoposition::ERROR_CODE_NONE) {
+ if (differ ||
+ new_position.error_code != content::Geoposition::ERROR_CODE_NONE) {
// Update if the new location is interesting or we have an error to report.
position_ = new_position;
UpdateListeners();

Powered by Google App Engine
This is Rietveld 408576698