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

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

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

Powered by Google App Engine
This is Rietveld 408576698