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

Side by Side Diff: device/geolocation/geoposition.cc

Issue 2192683003: Revert of Reland: Geolocation: move from content/browser to device/ (patchset #2 id:20001 of https:… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2810
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « device/geolocation/geoposition.h ('k') | device/geolocation/location_api_adapter_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "device/geolocation/geoposition.h"
6
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;
17 }
18
19 namespace device {
20
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) {
30 }
31
32 Geoposition::Geoposition(const Geoposition& other) = default;
33
34 bool Geoposition::Validate() const {
35 return latitude >= -90. && latitude <= 90. &&
36 longitude >= -180. && longitude <= 180. &&
37 accuracy >= 0. &&
38 !timestamp.is_null();
39 }
40
41 } // namespace device
OLDNEW
« no previous file with comments | « device/geolocation/geoposition.h ('k') | device/geolocation/location_api_adapter_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698