michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIURI; michael@0: interface nsIDOMWindow; michael@0: interface nsIDOMElement; michael@0: interface nsIDOMGeoPosition; michael@0: interface nsIGeolocationPrompt; michael@0: michael@0: /** michael@0: michael@0: * Interface provides a way for a geolocation provider to michael@0: * notify the system that a new location is available. michael@0: */ michael@0: [scriptable, uuid(643dc5e9-b911-4b2c-8d44-603162696baf)] michael@0: interface nsIGeolocationUpdate : nsISupports { michael@0: michael@0: /** michael@0: * Notify the geolocation service that a new geolocation michael@0: * has been discovered. michael@0: * This must be called on the main thread michael@0: */ michael@0: void update(in nsIDOMGeoPosition position); michael@0: michael@0: /** michael@0: * Notify the geolocation service that the location has michael@0: * potentially changed, and thus a new position is in the michael@0: * process of being acquired. michael@0: */ michael@0: void locationUpdatePending(); michael@0: michael@0: /** michael@0: * Notify the geolocation service of an error. michael@0: * This must be called on the main thread. michael@0: * The parameter refers to one of the constants in the michael@0: * nsIDOMGeoPositionError interface. michael@0: * Use this to report spurious errors coming from the michael@0: * provider; for errors occurring inside the methods in michael@0: * the nsIGeolocationProvider interface, just use the return michael@0: * value. michael@0: */ michael@0: void notifyError(in unsigned short error); michael@0: }; michael@0: michael@0: michael@0: /** michael@0: * Interface provides location information to the nsGeolocator michael@0: * via the nsIDOMGeolocationCallback interface. After michael@0: * startup is called, any geo location change should call michael@0: * callback.update(). michael@0: */ michael@0: [scriptable, uuid(AC4A133B-9F92-4F7C-B369-D40CB6B17650)] michael@0: interface nsIGeolocationProvider : nsISupports { michael@0: michael@0: /** michael@0: * Start up the provider. This is called before any other michael@0: * method. may be called multiple times. michael@0: */ michael@0: void startup(); michael@0: michael@0: /** michael@0: * watch michael@0: * When a location change is observed, notify the callback. michael@0: */ michael@0: void watch(in nsIGeolocationUpdate callback); michael@0: michael@0: /** michael@0: * shutdown michael@0: * Shuts down the location device. michael@0: */ michael@0: void shutdown(); michael@0: michael@0: /** michael@0: * hint to provide to use any amount of power to provide a better result michael@0: */ michael@0: void setHighAccuracy(in boolean enable); michael@0: michael@0: }; michael@0: michael@0: %{C++ michael@0: /* michael@0: This must be implemented by geolocation providers. It michael@0: must support nsIGeolocationProvider. michael@0: */ michael@0: #define NS_GEOLOCATION_PROVIDER_CONTRACTID "@mozilla.org/geolocation/provider;1" michael@0: %}