OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Geoposition structure, used to represent a position | 5 module blink.mojom; |
6 // fix. It was originally derived from: | 6 |
| 7 // A Geoposition represents a position fix. It was originally derived from: |
7 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation.h | 8 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation.h |
8 // TODO(blundell): Investigate killing content::Geoposition in favor of using | 9 // TODO(blundell): Investigate killing content::Geoposition in favor of using |
9 // this struct everywhere (and renaming it to Geoposition). | 10 // this struct everywhere. |
10 | 11 struct Geoposition { |
11 module content.mojom; | |
12 | |
13 struct MojoGeoposition { | |
14 // These values follow the W3C geolocation specification and can be returned | 12 // These values follow the W3C geolocation specification and can be returned |
15 // to JavaScript without the need for a conversion. | 13 // to JavaScript without the need for a conversion. |
16 enum ErrorCode { | 14 enum ErrorCode { |
17 NONE = 0, // Chrome addition. | 15 NONE = 0, // Chrome addition. |
18 PERMISSION_DENIED = 1, | 16 PERMISSION_DENIED = 1, |
19 POSITION_UNAVAILABLE = 2, | 17 POSITION_UNAVAILABLE = 2, |
20 TIMEOUT = 3, | 18 TIMEOUT = 3, |
21 LAST = TIMEOUT | 19 LAST = TIMEOUT |
22 }; | 20 }; |
23 | 21 |
(...skipping 23 matching lines...) Expand all Loading... |
47 // Time of position measurement in seconds since Epoch in UTC time. This is | 45 // Time of position measurement in seconds since Epoch in UTC time. This is |
48 // taken from the host computer's system clock (i.e. from Time::Now(), not the | 46 // taken from the host computer's system clock (i.e. from Time::Now(), not the |
49 // source device's clock). | 47 // source device's clock). |
50 double timestamp; | 48 double timestamp; |
51 | 49 |
52 // Error code, see enum above. | 50 // Error code, see enum above. |
53 ErrorCode error_code; | 51 ErrorCode error_code; |
54 // Human-readable error message. | 52 // Human-readable error message. |
55 string error_message; | 53 string error_message; |
56 }; | 54 }; |
| 55 |
| 56 // The Geolocation service provides updates on the device's location. By |
| 57 // default, it provides updates with low accuracy, but |SetHighAccuracy()| may |
| 58 // be called to change this. |
| 59 interface GeolocationService { |
| 60 SetHighAccuracy(bool high_accuracy); |
| 61 |
| 62 // Position is reported once it changes or immediately (to report the initial |
| 63 // position) if this is the first call to QueryNextPosition on this instance. |
| 64 // Position updates may be throttled by the service. Overlapping calls to |
| 65 // this method are prohibited and will be treated as a connection error. |
| 66 QueryNextPosition() => (Geoposition geoposition); |
| 67 }; |
OLD | NEW |