mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
[Bug 503942] Implement Geolocation Addresses r=jst, sr=jst
This commit is contained in:
parent
7d7253ddaa
commit
d4120e91bc
@ -49,6 +49,7 @@ GRE_MODULE = 1
|
||||
XPIDLSRCS = \
|
||||
nsIDOMGeoGeolocation.idl \
|
||||
nsIDOMGeoPosition.idl \
|
||||
nsIDOMGeoPositionAddress.idl \
|
||||
nsIDOMGeoPositionCoords.idl \
|
||||
nsIDOMGeoPositionCallback.idl \
|
||||
nsIDOMGeoPositionError.idl \
|
||||
|
@ -37,10 +37,13 @@
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMGeoPositionCoords.idl"
|
||||
#include "nsIDOMGeoPositionAddress.idl"
|
||||
|
||||
[scriptable, uuid(76888EB0-5EAB-4BE6-BFE0-489EC4095358)]
|
||||
[scriptable, uuid(23E5269F-4DD7-41C4-B52A-75918694C2DE)]
|
||||
interface nsIDOMGeoPosition : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMGeoPositionCoords coords;
|
||||
readonly attribute DOMTimeStamp timestamp;
|
||||
readonly attribute nsIDOMGeoPositionCoords coords;
|
||||
readonly attribute nsIDOMGeoPositionAddress address;
|
||||
|
||||
};
|
||||
|
52
dom/interfaces/geolocation/nsIDOMGeoPositionAddress.idl
Normal file
52
dom/interfaces/geolocation/nsIDOMGeoPositionAddress.idl
Normal file
@ -0,0 +1,52 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Geolocation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@meer.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(98808DEB-C8E4-422C-BA97-08BF2031464C)]
|
||||
interface nsIDOMGeoPositionAddress : nsISupports
|
||||
{
|
||||
readonly attribute string streetNumber;
|
||||
readonly attribute string street;
|
||||
readonly attribute string premises;
|
||||
readonly attribute string city;
|
||||
readonly attribute string county;
|
||||
readonly attribute string region;
|
||||
readonly attribute string country;
|
||||
readonly attribute string countryCode;
|
||||
readonly attribute string postalCode;
|
||||
};
|
@ -20,6 +20,37 @@ function LOG(aMsg) {
|
||||
}
|
||||
}
|
||||
|
||||
function WifiGeoAddressObject(streetNumber, street, premises, city, county, region, country, countryCode, postalCode) {
|
||||
|
||||
this.streetNumber = streetNumber;
|
||||
this.street = street;
|
||||
this.premises = premises;
|
||||
this.city = city;
|
||||
this.county = county;
|
||||
this.region = region;
|
||||
this.country = country;
|
||||
this.countryCode = countryCode;
|
||||
this.postalCode = postalCode;
|
||||
}
|
||||
|
||||
WifiGeoAddressObject.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionAddress, Ci.nsIClassInfo]),
|
||||
|
||||
getInterfaces: function(countRef) {
|
||||
var interfaces = [Ci.nsIDOMGeoPositionAddress, Ci.nsIClassInfo, Ci.nsISupports];
|
||||
countRef.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
|
||||
getHelperForLanguage: function(language) null,
|
||||
contractID: "",
|
||||
classDescription: "wifi geo position address object",
|
||||
classID: null,
|
||||
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
};
|
||||
|
||||
function WifiGeoCoordsObject(lat, lon, acc) {
|
||||
this.latitude = lat;
|
||||
this.longitude = lon;
|
||||
@ -53,8 +84,9 @@ WifiGeoCoordsObject.prototype = {
|
||||
speed: 0,
|
||||
};
|
||||
|
||||
function WifiGeoPositionObject(lat, lon, acc) {
|
||||
function WifiGeoPositionObject(lat, lon, acc, streetNumber, street, premises, city, county, region, county, countryCode, postalCode) {
|
||||
this.coords = new WifiGeoCoordsObject(lat, lon, acc);
|
||||
this.address = new WifiGeoAddressObject(streetNumber, street, premises, city, county, region, county, countryCode, postalCode);
|
||||
this.timestamp = Date.now();
|
||||
};
|
||||
|
||||
@ -240,7 +272,16 @@ WifiGeoPositionProvider.prototype = {
|
||||
|
||||
var newLocation = new WifiGeoPositionObject(response.location.latitude,
|
||||
response.location.longitude,
|
||||
response.location.accuracy);
|
||||
response.location.accuracy,
|
||||
response.location.address.street_number,
|
||||
response.location.address.street,
|
||||
response.location.address.premises,
|
||||
response.location.address.city,
|
||||
response.location.address.county,
|
||||
response.location.address.region,
|
||||
response.location.address.county,
|
||||
response.location.address.country_code,
|
||||
response.location.address.postal_code);
|
||||
|
||||
var update = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationUpdate);
|
||||
update.update(newLocation);
|
||||
@ -250,7 +291,7 @@ WifiGeoPositionProvider.prototype = {
|
||||
|
||||
var request = {
|
||||
version: "1.1.0",
|
||||
// request_address: true,
|
||||
request_address: true,
|
||||
};
|
||||
|
||||
if (accessToken != "")
|
||||
|
Loading…
Reference in New Issue
Block a user