|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 interface nsIURI; |
|
10 interface nsIDOMWindow; |
|
11 interface nsIDOMElement; |
|
12 interface nsIDOMGeoPosition; |
|
13 interface nsIGeolocationPrompt; |
|
14 |
|
15 /** |
|
16 |
|
17 * Interface provides a way for a geolocation provider to |
|
18 * notify the system that a new location is available. |
|
19 */ |
|
20 [scriptable, uuid(643dc5e9-b911-4b2c-8d44-603162696baf)] |
|
21 interface nsIGeolocationUpdate : nsISupports { |
|
22 |
|
23 /** |
|
24 * Notify the geolocation service that a new geolocation |
|
25 * has been discovered. |
|
26 * This must be called on the main thread |
|
27 */ |
|
28 void update(in nsIDOMGeoPosition position); |
|
29 |
|
30 /** |
|
31 * Notify the geolocation service that the location has |
|
32 * potentially changed, and thus a new position is in the |
|
33 * process of being acquired. |
|
34 */ |
|
35 void locationUpdatePending(); |
|
36 |
|
37 /** |
|
38 * Notify the geolocation service of an error. |
|
39 * This must be called on the main thread. |
|
40 * The parameter refers to one of the constants in the |
|
41 * nsIDOMGeoPositionError interface. |
|
42 * Use this to report spurious errors coming from the |
|
43 * provider; for errors occurring inside the methods in |
|
44 * the nsIGeolocationProvider interface, just use the return |
|
45 * value. |
|
46 */ |
|
47 void notifyError(in unsigned short error); |
|
48 }; |
|
49 |
|
50 |
|
51 /** |
|
52 * Interface provides location information to the nsGeolocator |
|
53 * via the nsIDOMGeolocationCallback interface. After |
|
54 * startup is called, any geo location change should call |
|
55 * callback.update(). |
|
56 */ |
|
57 [scriptable, uuid(AC4A133B-9F92-4F7C-B369-D40CB6B17650)] |
|
58 interface nsIGeolocationProvider : nsISupports { |
|
59 |
|
60 /** |
|
61 * Start up the provider. This is called before any other |
|
62 * method. may be called multiple times. |
|
63 */ |
|
64 void startup(); |
|
65 |
|
66 /** |
|
67 * watch |
|
68 * When a location change is observed, notify the callback. |
|
69 */ |
|
70 void watch(in nsIGeolocationUpdate callback); |
|
71 |
|
72 /** |
|
73 * shutdown |
|
74 * Shuts down the location device. |
|
75 */ |
|
76 void shutdown(); |
|
77 |
|
78 /** |
|
79 * hint to provide to use any amount of power to provide a better result |
|
80 */ |
|
81 void setHighAccuracy(in boolean enable); |
|
82 |
|
83 }; |
|
84 |
|
85 %{C++ |
|
86 /* |
|
87 This must be implemented by geolocation providers. It |
|
88 must support nsIGeolocationProvider. |
|
89 */ |
|
90 #define NS_GEOLOCATION_PROVIDER_CONTRACTID "@mozilla.org/geolocation/provider;1" |
|
91 %} |