| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module blink.mojom; | |
| 6 | |
| 7 // A Geoposition represents a position fix. It was originally derived from: | |
| 8 // http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation.h | |
| 9 // TODO(blundell): Investigate killing content::Geoposition in favor of using | |
| 10 // this struct everywhere. | |
| 11 struct Geoposition { | |
| 12 // These values follow the W3C geolocation specification and can be returned | |
| 13 // to JavaScript without the need for a conversion. | |
| 14 enum ErrorCode { | |
| 15 NONE = 0, // Chrome addition. | |
| 16 PERMISSION_DENIED = 1, | |
| 17 POSITION_UNAVAILABLE = 2, | |
| 18 TIMEOUT = 3, | |
| 19 LAST = TIMEOUT | |
| 20 }; | |
| 21 | |
| 22 // Whether this geoposition is valid. | |
| 23 bool valid; | |
| 24 | |
| 25 // These properties correspond to those of the JavaScript Position object | |
| 26 // although their types may differ. | |
| 27 // Latitude in decimal degrees north (WGS84 coordinate frame). | |
| 28 double latitude; | |
| 29 // Longitude in decimal degrees west (WGS84 coordinate frame). | |
| 30 double longitude; | |
| 31 // Altitude in meters (above WGS84 datum). | |
| 32 double altitude; | |
| 33 // Accuracy of horizontal position in meters. | |
| 34 double accuracy; | |
| 35 // Accuracy of altitude in meters. | |
| 36 double altitude_accuracy; | |
| 37 // Heading in decimal degrees clockwise from true north. | |
| 38 double heading; | |
| 39 // Horizontal component of device velocity in meters per second. | |
| 40 double speed; | |
| 41 // TODO(blundell): If I need to represent this differently to use this | |
| 42 // struct to replace content::Geolocation, I'll need to convert | |
| 43 // correctly into seconds-since-epoch when using this in | |
| 44 // GeolocationDispatcher::OnLocationUpdate(). | |
| 45 // Time of position measurement in seconds since Epoch in UTC time. This is | |
| 46 // taken from the host computer's system clock (i.e. from Time::Now(), not the | |
| 47 // source device's clock). | |
| 48 double timestamp; | |
| 49 | |
| 50 // Error code, see enum above. | |
| 51 ErrorCode error_code; | |
| 52 // Human-readable error message. | |
| 53 string error_message; | |
| 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 |