1 // Copyright (c) 2013 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 // TODO(vadimt): Consider reusing WebKit/Blink types, if this is possible.
6 // Use the <code>chrome.location</code> API to retrieve the geographic location
7 // of the host machine. This API is a version of the <a
8 // href="http://dev.w3.org/geo/api/spec-source.html">HTML Geolocation API</a>
9 // that is compatible with event pages.
11 // Coordinates part of the Location object.
12 dictionary Coordinates
{
13 // The geographic latitude specified in degrees.
16 // The geographic longitude specified in degrees.
19 // The height of the position, specified in meters above the [WGS84]
20 // ellipsoid, or null if Chrome cannot provide altitude information.
23 // The accuracy of the latitude and longitude coordinates, in meters. This
24 // represents the radius of a circle around the given location.
27 // The accuracy in meters of the 'altitude' attribute if it's not null,
29 double? altitudeAccuracy
;
31 // The direction of travel of the hosting device and is specified in
32 // degrees, where 0 <= heading < 360, counting clockwise relative to the
33 // true north. If the Chrome cannot provide heading information, the value
34 // of this attribute is null. If the hosting device is stationary (i.e. the
35 // value of the speed attribute is 0), then the value of the heading
39 // The magnitude of the horizontal component of the hosting device's current
40 // velocity and is specified in meters per second. If the Chrome cannot
41 // provide speed information, the value of this attribute is null.
45 // Parameter of onLocationUpdate event's listener.
47 // Location watch request name.
50 // Coordinates and their accuracy.
53 // The time when the Location object was acquired in milliseconds since the
54 // start of the Unix Epoch.
58 // Parameter of watchLocation call.
59 dictionary WatchLocationRequestInfo
{
60 // Minimum distance between location updates, in meters. Defaults to 0 - any
61 // change in location will be reported.
62 double? minDistanceInMeters
;
64 // Minimum time interval between location updates, in milliseconds. Defaults
65 // to 0 - system-defined frequency of updates will be used.
66 double? minTimeInMilliseconds
;
68 // Maximum age of a cached location, in milliseconds, that Chrome can pass
69 // to the first onLocationUpdate event for this location watch request.
70 // If this value <= 0, Chrome will always attempt to acquire a new location.
75 // TODO(vadimt): Consider adding getWatch() and getAllWatches().
77 // Starts a location watching request. If there is another location watching
78 // request with the same name (or no name if none is specified), it will be
79 // cancelled and replaced by this request.
80 // |name| : Optional name to identify this request. Defaults to the empty
82 // |requestInfo| : Optional parameters for this request.
83 static
void watchLocation
(DOMString name
,
84 WatchLocationRequestInfo requestInfo
);
86 // Ends a location watching request.
87 // |name| : Optional name to identify the request to remove. Defaults to the
89 static
void clearWatch
(DOMString name
);
93 // Fired when a location change is detected.
94 // |location| : An object containing matching events and new location.
95 static
void onLocationUpdate
(Location location
);
97 // Fired when detecting location in not possible.
98 // |error| : Human-readable error description.
99 static
void onLocationError
(DOMString error
);