diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 19:33:11 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 19:33:11 +0000 |
commit | 9384d383165e6e99e4430d9074a754ccebed34f9 (patch) | |
tree | 1dead35ee35b5b4119d713fe30f29586573d5b8e /chrome/common/geoposition.cc | |
parent | e989df19ef4bce3cd257ef77c19b0f3f4e1376bd (diff) | |
download | chromium_src-9384d383165e6e99e4430d9074a754ccebed34f9.zip chromium_src-9384d383165e6e99e4430d9074a754ccebed34f9.tar.gz chromium_src-9384d383165e6e99e4430d9074a754ccebed34f9.tar.bz2 |
Revert 39366 - Initial Geolocation implementation
Adds IPC plumbing.
Adds Infobar buttons for requesting permission
TEST=geolocation_browsertest.cc
Review URL: http://codereview.chromium.org/548188
TBR=bulach@chromium.org
Review URL: http://codereview.chromium.org/646027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39374 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/geoposition.cc')
-rw-r--r-- | chrome/common/geoposition.cc | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/chrome/common/geoposition.cc b/chrome/common/geoposition.cc deleted file mode 100644 index d4989ed..0000000 --- a/chrome/common/geoposition.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2010 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 "chrome/common/geoposition.h" - -namespace { -// Sentinel values to mark invalid data. (WebKit carries companion is_valid -// bools for this purpose; we may eventually follow that approach, but -// sentinels worked OK in the gears code this is based on.) -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; -} - -Geoposition::Geoposition() - : latitude(kBadLatitudeLongitude), - longitude(kBadLatitudeLongitude), - altitude(kBadAltitude), - accuracy(kBadAccuracy), - altitude_accuracy(kBadAccuracy), - heading(kBadHeading), - speed(kBadSpeed), - timestamp(kBadTimestamp), - 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 != kBadTimestamp; -} - -bool Geoposition::IsValidFix() const { - return is_valid_latlong() && is_valid_accuracy() && is_valid_timestamp(); -} - -bool Geoposition::IsInitialized() const { - return error_code != ERROR_CODE_NONE || IsValidFix(); -} |