1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/system/nsIGeolocationProvider.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,91 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 + 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsIURI; 1.13 +interface nsIDOMWindow; 1.14 +interface nsIDOMElement; 1.15 +interface nsIDOMGeoPosition; 1.16 +interface nsIGeolocationPrompt; 1.17 + 1.18 +/** 1.19 + 1.20 + * Interface provides a way for a geolocation provider to 1.21 + * notify the system that a new location is available. 1.22 + */ 1.23 +[scriptable, uuid(643dc5e9-b911-4b2c-8d44-603162696baf)] 1.24 +interface nsIGeolocationUpdate : nsISupports { 1.25 + 1.26 + /** 1.27 + * Notify the geolocation service that a new geolocation 1.28 + * has been discovered. 1.29 + * This must be called on the main thread 1.30 + */ 1.31 + void update(in nsIDOMGeoPosition position); 1.32 + 1.33 + /** 1.34 + * Notify the geolocation service that the location has 1.35 + * potentially changed, and thus a new position is in the 1.36 + * process of being acquired. 1.37 + */ 1.38 + void locationUpdatePending(); 1.39 + 1.40 + /** 1.41 + * Notify the geolocation service of an error. 1.42 + * This must be called on the main thread. 1.43 + * The parameter refers to one of the constants in the 1.44 + * nsIDOMGeoPositionError interface. 1.45 + * Use this to report spurious errors coming from the 1.46 + * provider; for errors occurring inside the methods in 1.47 + * the nsIGeolocationProvider interface, just use the return 1.48 + * value. 1.49 + */ 1.50 + void notifyError(in unsigned short error); 1.51 +}; 1.52 + 1.53 + 1.54 +/** 1.55 + * Interface provides location information to the nsGeolocator 1.56 + * via the nsIDOMGeolocationCallback interface. After 1.57 + * startup is called, any geo location change should call 1.58 + * callback.update(). 1.59 + */ 1.60 +[scriptable, uuid(AC4A133B-9F92-4F7C-B369-D40CB6B17650)] 1.61 +interface nsIGeolocationProvider : nsISupports { 1.62 + 1.63 + /** 1.64 + * Start up the provider. This is called before any other 1.65 + * method. may be called multiple times. 1.66 + */ 1.67 + void startup(); 1.68 + 1.69 + /** 1.70 + * watch 1.71 + * When a location change is observed, notify the callback. 1.72 + */ 1.73 + void watch(in nsIGeolocationUpdate callback); 1.74 + 1.75 + /** 1.76 + * shutdown 1.77 + * Shuts down the location device. 1.78 + */ 1.79 + void shutdown(); 1.80 + 1.81 + /** 1.82 + * hint to provide to use any amount of power to provide a better result 1.83 + */ 1.84 + void setHighAccuracy(in boolean enable); 1.85 + 1.86 +}; 1.87 + 1.88 +%{C++ 1.89 +/* 1.90 + This must be implemented by geolocation providers. It 1.91 + must support nsIGeolocationProvider. 1.92 +*/ 1.93 +#define NS_GEOLOCATION_PROVIDER_CONTRACTID "@mozilla.org/geolocation/provider;1" 1.94 +%}