| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file declares the Position structure, which is used to represent a | 5 // This file declares the Position structure, which is used to represent a |
| 6 // position fix. Originally derived from | 6 // position fix. Originally derived from |
| 7 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation.h | 7 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation.h |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_GEOLOCATION_GEOPOSITION_H_ | 9 #ifndef CHROME_BROWSER_GEOLOCATION_GEOPOSITION_H_ |
| 10 #define CHROME_BROWSER_GEOLOCATION_GEOPOSITION_H_ | 10 #define CHROME_BROWSER_GEOLOCATION_GEOPOSITION_H_ |
| 11 | 11 |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 | 13 |
| 14 // The internal representation of a position. Some properties use different | 14 // The internal representation of a position. Some properties use different |
| 15 // types when passed to JavaScript. | 15 // types when passed to JavaScript. |
| 16 struct Position { | 16 struct Position { |
| 17 public: | 17 public: |
| 18 // Error codes for returning to JavaScript. These values are defined by the | 18 // Error codes for returning to JavaScript. These values are defined by the |
| 19 // W3C spec. Note that Gears does not use all of these codes, but we need | 19 // W3C spec. Note that Gears does not use all of these codes, but we need |
| 20 // values for all of them to allow us to provide the constants on the error | 20 // values for all of them to allow us to provide the constants on the error |
| 21 // object. | 21 // object. |
| 22 enum ErrorCode { | 22 enum ErrorCode { |
| 23 ERROR_CODE_NONE = -1, // Gears addition | 23 ERROR_CODE_NONE = 0, // Chrome addition |
| 24 ERROR_CODE_UNKNOWN_ERROR = 0, // Not used by Gears | 24 ERROR_CODE_PERMISSION_DENIED = 1, |
| 25 ERROR_CODE_PERMISSION_DENIED = 1, // Not used by Gears - Geolocation | |
| 26 // methods throw an exception if | |
| 27 // permission has not been granted. | |
| 28 ERROR_CODE_POSITION_UNAVAILABLE = 2, | 25 ERROR_CODE_POSITION_UNAVAILABLE = 2, |
| 29 ERROR_CODE_TIMEOUT = 3, | 26 ERROR_CODE_TIMEOUT = 3, |
| 30 }; | 27 }; |
| 31 | 28 |
| 32 Position(); | 29 Position(); |
| 33 | 30 |
| 34 bool is_valid_latlong() const; | 31 bool is_valid_latlong() const; |
| 35 bool is_valid_altitude() const; | 32 bool is_valid_altitude() const; |
| 36 bool is_valid_accuracy() const; | 33 bool is_valid_accuracy() const; |
| 37 bool is_valid_altitude_accuracy() const; | 34 bool is_valid_altitude_accuracy() const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 double accuracy; // In metres | 48 double accuracy; // In metres |
| 52 double altitude_accuracy; // In metres | 49 double altitude_accuracy; // In metres |
| 53 int64 timestamp; // Milliseconds since 1st Jan 1970 | 50 int64 timestamp; // Milliseconds since 1st Jan 1970 |
| 54 | 51 |
| 55 // These properties are returned to JavaScript as a PositionError object. | 52 // These properties are returned to JavaScript as a PositionError object. |
| 56 ErrorCode error_code; | 53 ErrorCode error_code; |
| 57 std::wstring error_message; // Human-readable error message | 54 std::wstring error_message; // Human-readable error message |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 #endif // CHROME_BROWSER_GEOLOCATION_GEOPOSITION_H_ | 57 #endif // CHROME_BROWSER_GEOLOCATION_GEOPOSITION_H_ |
| OLD | NEW |