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

Side by Side Diff: content/common/geoposition.h

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, 7 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 | « content/common/geolocation_messages.h ('k') | content/common/geoposition.cc » ('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) 2011 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 // This file declares the Position structure, which is used to represent a
6 // position fix. Originally derived from
7 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation.h
8
9 #ifndef CONTENT_COMMON_GEOPOSITION_H_
10 #define CONTENT_COMMON_GEOPOSITION_H_
11 #pragma once
12
13 #include <string>
14 #include "base/time.h"
15 #include "content/common/content_export.h"
16
17 // The internal representation of a geo position. Some properties use different
18 // types when passed to JavaScript.
19 struct CONTENT_EXPORT Geoposition {
20 public:
21 // Error codes for returning to JavaScript. These values are defined by the
22 // W3C spec. Note that Gears does not use all of these codes, but we need
23 // values for all of them to allow us to provide the constants on the error
24 // object.
25 enum ErrorCode {
26 ERROR_CODE_NONE = 0, // Chrome addition
27 ERROR_CODE_PERMISSION_DENIED = 1,
28 ERROR_CODE_POSITION_UNAVAILABLE = 2,
29 ERROR_CODE_TIMEOUT = 3,
30 };
31
32 Geoposition();
33
34 bool is_valid_latlong() const;
35 bool is_valid_altitude() const;
36 bool is_valid_accuracy() const;
37 bool is_valid_altitude_accuracy() const;
38 bool is_valid_heading() const;
39 bool is_valid_speed() const;
40 bool is_valid_timestamp() const;
41
42 // A valid fix has a valid latitude, longitude, accuracy and timestamp.
43 bool IsValidFix() const;
44
45 // A position is considered initialized if it has either a valid fix or
46 // an error code other than NONE.
47 bool IsInitialized() const;
48
49 // These properties correspond to the JavaScript Position object.
50 double latitude; // In degrees
51 double longitude; // In degrees
52 double altitude; // In metres
53 double accuracy; // In metres
54 double altitude_accuracy; // In metres
55 double heading; // In degrees clockwise relative to the true north
56 double speed; // In meters per second
57 // Timestamp for this position fix object taken from the host computer's
58 // system clock (i.e. from Time::Now(), not the source device's clock).
59 base::Time timestamp;
60
61 // These properties are returned to JavaScript as a PositionError object.
62 ErrorCode error_code;
63 std::string error_message; // Human-readable error message
64 };
65
66 #endif // CONTENT_COMMON_GEOPOSITION_H_
OLDNEW
« no previous file with comments | « content/common/geolocation_messages.h ('k') | content/common/geoposition.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698