Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / common / geoposition.cc
blob3a0f1f08b1847e4e6b616a38b7e7813bc99f4446
1 // Copyright (c) 2012 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.
5 #include "content/public/common/geoposition.h"
7 namespace {
8 // Sentinel values to mark invalid data. (WebKit carries companion is_valid
9 // bools for this purpose; we may eventually follow that approach, but
10 // sentinels worked OK in the Gears code this is based on.)
11 const double kBadLatitudeLongitude = 200;
12 // Lowest point on land is at approximately -400 meters.
13 const int kBadAltitude = -10000;
14 const int kBadAccuracy = -1; // Accuracy must be non-negative.
15 const int kBadHeading = -1; // Heading must be non-negative.
16 const int kBadSpeed = -1;
19 namespace content {
21 Geoposition::Geoposition()
22 : latitude(kBadLatitudeLongitude),
23 longitude(kBadLatitudeLongitude),
24 altitude(kBadAltitude),
25 accuracy(kBadAccuracy),
26 altitude_accuracy(kBadAccuracy),
27 heading(kBadHeading),
28 speed(kBadSpeed),
29 error_code(ERROR_CODE_NONE) {
32 bool Geoposition::Validate() const {
33 return latitude >= -90. && latitude <= 90. &&
34 longitude >= -180. && longitude <= 180. &&
35 accuracy >= 0. &&
36 !timestamp.is_null();
39 } // namespace content