| Index: content/public/common/geoposition.cc
|
| diff --git a/content/common/geoposition.cc b/content/public/common/geoposition.cc
|
| similarity index 47%
|
| rename from content/common/geoposition.cc
|
| rename to content/public/common/geoposition.cc
|
| index 4beac7440bfa70a08bd8b6261c6797dc3d7e1bd9..3a0f1f08b1847e4e6b616a38b7e7813bc99f4446 100644
|
| --- a/content/common/geoposition.cc
|
| +++ b/content/public/common/geoposition.cc
|
| @@ -1,8 +1,8 @@
|
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/common/geoposition.h"
|
| +#include "content/public/common/geoposition.h"
|
|
|
| namespace {
|
| // Sentinel values to mark invalid data. (WebKit carries companion is_valid
|
| @@ -12,11 +12,12 @@ const double kBadLatitudeLongitude = 200;
|
| // Lowest point on land is at approximately -400 meters.
|
| const int kBadAltitude = -10000;
|
| const int kBadAccuracy = -1; // Accuracy must be non-negative.
|
| -const int64 kBadTimestamp = kint64min;
|
| const int kBadHeading = -1; // Heading must be non-negative.
|
| const int kBadSpeed = -1;
|
| }
|
|
|
| +namespace content {
|
| +
|
| Geoposition::Geoposition()
|
| : latitude(kBadLatitudeLongitude),
|
| longitude(kBadLatitudeLongitude),
|
| @@ -28,39 +29,11 @@ Geoposition::Geoposition()
|
| error_code(ERROR_CODE_NONE) {
|
| }
|
|
|
| -bool Geoposition::is_valid_latlong() const {
|
| - return latitude >= -90.0 && latitude <= 90.0 &&
|
| - longitude >= -180.0 && longitude <= 180.0;
|
| -}
|
| -
|
| -bool Geoposition::is_valid_altitude() const {
|
| - return altitude > kBadAltitude;
|
| -}
|
| -
|
| -bool Geoposition::is_valid_accuracy() const {
|
| - return accuracy >= 0.0;
|
| -}
|
| -
|
| -bool Geoposition::is_valid_altitude_accuracy() const {
|
| - return altitude_accuracy >= 0.0;
|
| -}
|
| -
|
| -bool Geoposition::is_valid_heading() const {
|
| - return heading >= 0 && heading <= 360;
|
| -}
|
| -
|
| -bool Geoposition::is_valid_speed() const {
|
| - return speed >= 0;
|
| -}
|
| -
|
| -bool Geoposition::is_valid_timestamp() const {
|
| - return !timestamp.is_null();
|
| -}
|
| -
|
| -bool Geoposition::IsValidFix() const {
|
| - return is_valid_latlong() && is_valid_accuracy() && is_valid_timestamp();
|
| +bool Geoposition::Validate() const {
|
| + return latitude >= -90. && latitude <= 90. &&
|
| + longitude >= -180. && longitude <= 180. &&
|
| + accuracy >= 0. &&
|
| + !timestamp.is_null();
|
| }
|
|
|
| -bool Geoposition::IsInitialized() const {
|
| - return error_code != ERROR_CODE_NONE || IsValidFix();
|
| -}
|
| +} // namespace content
|
|
|