iBug 587414 - e10s: Geolocation needs to set pref from content process. r=jst a=blocking-fennec

This commit is contained in:
Doug Turner 2010-09-20 21:16:37 -07:00
Родитель 0149353c30
Коммит c64688d8e8
6 изменённых файлов: 199 добавлений и 26 удалений

Просмотреть файл

@ -1354,6 +1354,9 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(GeoPositionCoords, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(GeoPositionAddress, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(GeoPositionError, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -3890,6 +3893,10 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoPositionCoords)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(GeoPositionAddress, nsIDOMGeoPositionAddress)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoPositionAddress)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(GeoPositionError, nsIDOMGeoPositionError)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoPositionError)
DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -422,6 +422,7 @@ DOMCI_CLASS(MessageEvent)
DOMCI_CLASS(GeoGeolocation)
DOMCI_CLASS(GeoPosition)
DOMCI_CLASS(GeoPositionCoords)
DOMCI_CLASS(GeoPositionAddress)
DOMCI_CLASS(GeoPositionError)
// @font-face in CSS

Просмотреть файл

@ -51,6 +51,7 @@ FORCE_STATIC_LIB = 1
CPPSRCS = \
nsGeolocation.cpp \
nsGeoPosition.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \
@ -64,22 +65,20 @@ LOCAL_INCLUDES = \
-I$(topsrcdir)/content/events/src \
$(NULL)
EXPORTS = nsGeoPosition.h
ifdef WINCE_WINDOWS_MOBILE
CPPSRCS += nsGeoPosition.cpp
LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/windows \
$(NULL)
endif
ifdef MOZ_MAEMO_LIBLOCATION
CPPSRCS += nsGeoPosition.cpp
LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_CFLAGS) \
-I$(topsrcdir)/dom/system/unix \
$(NULL)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
CPPSRCS += nsGeoPosition.cpp
EXPORTS += nsGeoPosition.h
LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/android \
$(NULL)
endif

Просмотреть файл

@ -21,6 +21,7 @@
* Contributor(s):
* Doug Turner <dougt@meer.net> (Original Author)
* Nino D'Aversa <ninodaversa@gmail.com>
* Mike Kristoffersen <moz@mikek.dk>
*
* 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
@ -39,17 +40,123 @@
#include "nsGeoPosition.h"
#include "nsDOMClassInfo.h"
////////////////////////////////////////////////////
// nsGeoPositionAddress
////////////////////////////////////////////////////
nsGeoPositionAddress::nsGeoPositionAddress(const nsAString &aStreetNumber,
const nsAString &aStreet,
const nsAString &aPremises,
const nsAString &aCity,
const nsAString &aCounty,
const nsAString &aRegion,
const nsAString &aCountry,
const nsAString &aCountryCode,
const nsAString &aPostalCode)
: mStreetNumber(aStreetNumber)
, mStreet(aStreet)
, mPremises(aPremises)
, mCity(aCity)
, mCounty(aCounty)
, mRegion(aRegion)
, mCountry(aCountry)
, mCountryCode(aCountryCode)
, mPostalCode(aPostalCode)
{
}
nsGeoPositionAddress::~nsGeoPositionAddress()
{
}
DOMCI_DATA(GeoPositionAddress, nsGeoPositionAddress)
NS_INTERFACE_MAP_BEGIN(nsGeoPositionAddress)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionAddress)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionAddress)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionAddress)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsGeoPositionAddress)
NS_IMPL_RELEASE(nsGeoPositionAddress)
NS_IMETHODIMP
nsGeoPositionAddress::GetStreetNumber(nsAString & aStreetNumber)
{
aStreetNumber = mStreetNumber;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetStreet(nsAString & aStreet)
{
aStreet = mStreet;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetPremises(nsAString & aPremises)
{
aPremises = mPremises;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetCity(nsAString & aCity)
{
aCity = mCity;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetCounty(nsAString & aCounty)
{
aCounty = mCounty;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetRegion(nsAString & aRegion)
{
aRegion = mRegion;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetCountry(nsAString & aCountry)
{
aCountry = mCountry;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetCountryCode(nsAString & aCountryCode)
{
aCountryCode = mCountryCode;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionAddress::GetPostalCode(nsAString & aPostalCode)
{
aPostalCode = mPostalCode;
return NS_OK;
}
////////////////////////////////////////////////////
// nsGeoPositionCoords
////////////////////////////////////////////////////
nsGeoPositionCoords::nsGeoPositionCoords(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed) :
mLat(aLat), mLong(aLong),
mAlt(aAlt), mHError(aHError),
mVError(aVError), mHeading(aHeading),
mSpeed(aSpeed)
double aSpeed)
: mLat(aLat)
, mLong(aLong)
, mAlt(aAlt)
, mHError(aHError)
, mVError(aVError)
, mHeading(aHeading)
, mSpeed(aSpeed)
{
}
@ -65,8 +172,8 @@ NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCoords)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionCoords)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionCoords)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionCoords)
NS_IMPL_ADDREF(nsGeoPositionCoords)
NS_IMPL_RELEASE(nsGeoPositionCoords)
NS_IMETHODIMP
nsGeoPositionCoords::GetLatitude(double *aLatitude)
@ -133,7 +240,23 @@ nsGeoPosition::nsGeoPosition(double aLat, double aLong,
aSpeed);
NS_ASSERTION(mCoords, "null mCoords in nsGeoPosition");
}
nsGeoPosition::nsGeoPosition(nsIDOMGeoPositionCoords *aCoords,
long long aTimestamp) :
mCoords(aCoords),
mTimestamp(aTimestamp)
{
}
nsGeoPosition::nsGeoPosition(nsIDOMGeoPositionCoords *aCoords,
nsIDOMGeoPositionAddress *aAddress,
DOMTimeStamp aTimestamp) :
mTimestamp(aTimestamp),
mCoords(aCoords),
mAddress(aAddress)
{
}
nsGeoPosition::~nsGeoPosition()
{
}
@ -146,8 +269,8 @@ NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPosition)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPosition)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPosition)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPosition)
NS_IMPL_ADDREF(nsGeoPosition)
NS_IMPL_RELEASE(nsGeoPosition)
NS_IMETHODIMP
nsGeoPosition::GetTimestamp(DOMTimeStamp* aTimestamp)
@ -166,7 +289,7 @@ nsGeoPosition::GetCoords(nsIDOMGeoPositionCoords * *aCoords)
NS_IMETHODIMP
nsGeoPosition::GetAddress(nsIDOMGeoPositionAddress** aAddress)
{
*aAddress = nsnull;
NS_IF_ADDREF(*aAddress = mAddress);
return NS_OK;
}

Просмотреть файл

@ -21,6 +21,7 @@
* Contributor(s):
* Doug Turner <dougt@meer.net> (Original Author)
* Nino D'Aversa <ninodaversa@gmail.com>
* Mike Kristoffersen <moz@mikek.dk>
*
* 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
@ -42,8 +43,43 @@
#include "nsAutoPtr.h"
#include "nsIClassInfo.h"
#include "nsDOMClassInfoID.h"
#include "nsIDOMGeoPositionAddress.h"
#include "nsIDOMGeoPositionCoords.h"
#include "nsIDOMGeoPosition.h"
#include "nsString.h"
////////////////////////////////////////////////////
// nsGeoPositionAddress
////////////////////////////////////////////////////
class nsGeoPositionAddress : public nsIDOMGeoPositionAddress
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITIONADDRESS
nsGeoPositionAddress( const nsAString &aStreetNumber,
const nsAString &aStreet,
const nsAString &aPremises,
const nsAString &aCity,
const nsAString &aCounty,
const nsAString &aRegion,
const nsAString &aCountry,
const nsAString &aCountryCode,
const nsAString &aPostalCode);
private:
~nsGeoPositionAddress();
const nsString mStreetNumber;
const nsString mStreet;
const nsString mPremises;
const nsString mCity;
const nsString mCounty;
const nsString mRegion;
const nsString mCountry;
const nsString mCountryCode;
const nsString mPostalCode;
};
////////////////////////////////////////////////////
// nsGeoPositionCoords
@ -58,13 +94,16 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITIONCOORDS
nsGeoPositionCoords(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed);
nsGeoPositionCoords(const double aLat,
const double aLong,
const double aAlt,
const double aHError,
const double aVError,
const double aHeading,
const double aSpeed);
private:
~nsGeoPositionCoords();
double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
const double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
};
@ -83,10 +122,19 @@ public:
double aVError, double aHeading,
double aSpeed, long long aTimestamp);
nsGeoPosition(nsIDOMGeoPositionCoords *aCoords,
long long aTimestamp);
nsGeoPosition(nsIDOMGeoPositionCoords *aCoords,
nsIDOMGeoPositionAddress *aAddress,
DOMTimeStamp aTimestamp);
private:
~nsGeoPosition();
long long mTimestamp;
nsRefPtr<nsGeoPositionCoords> mCoords;
nsRefPtr<nsIDOMGeoPositionCoords> mCoords;
nsRefPtr<nsIDOMGeoPositionAddress> mAddress;
};
#endif /* nsGeoPosition_h */

Просмотреть файл

@ -1138,8 +1138,3 @@ nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
NS_DispatchToMainThread(ev);
}
#if !defined(WINCE_WINDOWS_MOBILE) && !defined(MOZ_MAEMO_LIBLOCATION) && !defined(ANDROID)
DOMCI_DATA(GeoPositionCoords, void)
DOMCI_DATA(GeoPosition, void)
#endif