Bug 797681 - Register GonkGPSGeoLocationProvider as a XPCOM service. r=dougt

This commit is contained in:
Kan-Ru Chen (陳侃如) 2012-10-15 14:40:51 +08:00
parent b85d4df899
commit df71a77f5d
4 changed files with 29 additions and 2 deletions

View File

@ -586,7 +586,7 @@ nsresult nsGeolocationService::Init()
#endif
#ifdef MOZ_WIDGET_GONK
provider = GonkGPSGeolocationProvider::GetSingleton();
provider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
if (provider) {
mProviders.AppendObject(provider);
}

View File

@ -25,6 +25,12 @@
class nsIThread;
#define GONK_GPS_GEOLOCATION_PROVIDER_CID \
{ 0x48525ec5, 0x5a7f, 0x490a, { 0x92, 0x77, 0xba, 0x66, 0xe0, 0xd2, 0x2c, 0x8b } }
#define GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID \
"@mozilla.org/gonk-gps-geolocation-provider;1"
class GonkGPSGeolocationProvider : public nsIGeolocationProvider
, public nsIRILDataCallback
{

View File

@ -71,7 +71,10 @@ CPPSRCS += \
$(NULL)
# for our local copy of AudioSystem.h
LOCAL_INCLUDES += -I$(topsrcdir)/media/libsydneyaudio/src
EXPORTS = nsVolume.h
EXPORTS = \
nsVolume.h \
GonkGPSGeolocationProvider.h \
$(NULL)
endif
EXTRA_COMPONENTS = \

View File

@ -243,6 +243,10 @@ static void Shutdown();
#include "mozilla/dom/alarm/AlarmHalService.h"
#include "mozilla/dom/time/TimeService.h"
#ifdef MOZ_WIDGET_GONK
#include "GonkGPSGeolocationProvider.h"
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::file;
@ -319,6 +323,11 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIAlarmHalService,
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITimeService,
TimeService::GetInstance)
#ifdef MOZ_WIDGET_GONK
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIGeolocationProvider,
GonkGPSGeolocationProvider::GetSingleton)
#endif
//-----------------------------------------------------------------------------
// Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
@ -829,6 +838,9 @@ NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_ALARMHALSERVICE_CID);
NS_DEFINE_NAMED_CID(TCPSOCKETCHILD_CID);
NS_DEFINE_NAMED_CID(NS_TIMESERVICE_CID);
#ifdef MOZ_WIDGET_GONK
NS_DEFINE_NAMED_CID(GONK_GPS_GEOLOCATION_PROVIDER_CID);
#endif
static nsresult
CreateWindowCommandTableConstructor(nsISupports *aOuter,
@ -1108,6 +1120,9 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_ALARMHALSERVICE_CID, false, NULL, nsIAlarmHalServiceConstructor },
{ &kTCPSOCKETCHILD_CID, false, NULL, TCPSocketChildConstructor },
{ &kNS_TIMESERVICE_CID, false, NULL, nsITimeServiceConstructor },
#ifdef MOZ_WIDGET_GONK
{ &kGONK_GPS_GEOLOCATION_PROVIDER_CID, false, NULL, nsIGeolocationProviderConstructor },
#endif
{ NULL }
};
@ -1252,6 +1267,9 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ ALARMHALSERVICE_CONTRACTID, &kNS_ALARMHALSERVICE_CID },
{ "@mozilla.org/tcp-socket-child;1", &kTCPSOCKETCHILD_CID },
{ TIMESERVICE_CONTRACTID, &kNS_TIMESERVICE_CID },
#ifdef MOZ_WIDGET_GONK
{ GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID, &kGONK_GPS_GEOLOCATION_PROVIDER_CID },
#endif
{ NULL }
};