Backed out changeset 69870df1c72f (bug 1064231)

This commit is contained in:
Carsten "Tomcat" Book 2014-09-17 13:12:59 +02:00
Родитель a3982c7141
Коммит 2847662955
24 изменённых файлов: 265 добавлений и 209 удалений

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

@ -9,13 +9,6 @@
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
// Service instantiation
#include "ipc/MobileConnectionIPCService.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkMobileConnectionService.h"
#endif
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileConnectionArray,
@ -96,19 +89,3 @@ MobileConnectionArray::IndexedGetter(uint32_t aIndex, bool& aFound)
return mMobileConnections[aIndex];
}
already_AddRefed<nsIMobileConnectionService>
NS_CreateMobileConnectionService()
{
nsCOMPtr<nsIMobileConnectionService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = new mozilla::dom::mobileconnection::MobileConnectionIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
service = do_CreateInstance(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
#endif
}
return service.forget();
}

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

@ -209,13 +209,6 @@ interface nsIMobileConnectionService : nsISupports
nsIMobileConnection getItemByServiceId(in unsigned long serviceId);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMobileConnectionService>
NS_CreateMobileConnectionService();
%}
[scriptable, uuid(04db7331-54fe-4cf7-9347-b9481350f4c2)]
interface nsIMobileConnection : nsISupports
{

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

@ -14,6 +14,21 @@ using namespace mozilla::dom::mobileconnection;
NS_IMPL_ISUPPORTS(MobileConnectionIPCService, nsIMobileConnectionService)
StaticRefPtr<MobileConnectionIPCService> sService;
/* static */MobileConnectionIPCService*
MobileConnectionIPCService::GetSingleton()
{
MOZ_ASSERT(NS_IsMainThread());
if (sService) {
return sService;
}
sService = new MobileConnectionIPCService();
return sService;
}
MobileConnectionIPCService::MobileConnectionIPCService()
{
int32_t numRil = Preferences::GetInt("ril.numRadioInterfaces", 1);

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

@ -19,9 +19,12 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILECONNECTIONSERVICE
MobileConnectionIPCService();
static MobileConnectionIPCService*
GetSingleton();
private:
MobileConnectionIPCService();
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~MobileConnectionIPCService();

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

@ -18,6 +18,7 @@ EXPORTS.mozilla.dom += [
EXPORTS.mozilla.dom.mobileconnection += [
'ipc/MobileConnectionChild.h',
'ipc/MobileConnectionIPCSerializer.h',
'ipc/MobileConnectionIPCService.h',
'ipc/MobileConnectionParent.h',
]

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

@ -23,23 +23,10 @@
#include "nsIMmsService.h"
#include "nsIMobileMessageCallback.h"
#include "nsIMobileMessageDatabaseService.h"
#include "nsIMobileMessageService.h"
#include "nsIObserverService.h"
#include "nsISmsService.h"
#include "nsServiceManagerUtils.h" // For do_GetService()
// Service instantiation
#include "ipc/SmsIPCService.h"
#include "MobileMessageService.h"
#ifdef MOZ_WIDGET_ANDROID
#include "android/MobileMessageDatabaseService.h"
#include "android/SmsService.h"
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIRilMobileMessageDatabaseService.h"
#include "gonk/SmsService.h"
#endif
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
#define RECEIVED_EVENT_NAME NS_LITERAL_STRING("received")
#define RETRIEVING_EVENT_NAME NS_LITERAL_STRING("retrieving")
#define SENDING_EVENT_NAME NS_LITERAL_STRING("sending")
@ -699,62 +686,3 @@ MobileMessageManager::GetSmscAddress(const Optional<uint32_t>& aServiceId,
} // namespace dom
} // namespace mozilla
already_AddRefed<nsISmsService>
NS_CreateSmsService()
{
nsCOMPtr<nsISmsService> smsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
smsService = SmsIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_ANDROID
smsService = new SmsService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
smsService = new SmsService();
#endif
}
return smsService.forget();
}
already_AddRefed<nsIMobileMessageDatabaseService>
NS_CreateMobileMessageDatabaseService()
{
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mobileMessageDBService = SmsIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_ANDROID
mobileMessageDBService = new MobileMessageDatabaseService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mobileMessageDBService =
do_CreateInstance(RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
#endif
}
return mobileMessageDBService.forget();
}
already_AddRefed<nsIMmsService>
NS_CreateMmsService()
{
nsCOMPtr<nsIMmsService> mmsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mmsService = SmsIPCService::GetSingleton();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mmsService = do_CreateInstance("@mozilla.org/mms/rilmmsservice;1");
#endif
}
return mmsService.forget();
}
already_AddRefed<nsIMobileMessageService>
NS_CreateMobileMessageService()
{
nsCOMPtr<nsIMobileMessageService> service = new MobileMessageService();
return service.forget();
}

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

@ -14,6 +14,20 @@ namespace mobilemessage {
NS_IMPL_ISUPPORTS(MobileMessageService, nsIMobileMessageService)
/* static */ StaticRefPtr<MobileMessageService> MobileMessageService::sSingleton;
/* static */ already_AddRefed<MobileMessageService>
MobileMessageService::GetInstance()
{
if (!sSingleton) {
sSingleton = new MobileMessageService();
ClearOnShutdown(&sSingleton);
}
nsRefPtr<MobileMessageService> service = sSingleton.get();
return service.forget();
}
NS_IMETHODIMP
MobileMessageService::CreateSmsMessage(int32_t aId,
uint64_t aThreadId,

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

@ -5,8 +5,9 @@
#ifndef mozilla_dom_mobilemessage_MobileMessageService_h
#define mozilla_dom_mobilemessage_MobileMessageService_h
#include "mozilla/Attributes.h" // For MOZ_FINAL
#include "nsIMobileMessageService.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/StaticPtr.h"
namespace mozilla {
namespace dom {
@ -18,11 +19,13 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILEMESSAGESERVICE
MobileMessageService() { MOZ_COUNT_CTOR(MobileMessageService); }
static already_AddRefed<MobileMessageService> GetInstance();
private:
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~MobileMessageService() { MOZ_COUNT_DTOR(MobileMessageService); }
~MobileMessageService() {}
static StaticRefPtr<MobileMessageService> sSingleton;
};
} // namespace mobilemessage

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

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SmsServicesFactory.h"
#include "nsXULAppAPI.h"
#include "ipc/SmsIPCService.h"
#ifdef MOZ_WIDGET_ANDROID
#include "android/MobileMessageDatabaseService.h"
#include "android/SmsService.h"
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "gonk/SmsService.h"
#endif
#include "nsServiceManagerUtils.h"
#define RIL_MMSSERVICE_CONTRACTID "@mozilla.org/mms/rilmmsservice;1"
#define RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID "@mozilla.org/mobilemessage/rilmobilemessagedatabaseservice;1"
namespace mozilla {
namespace dom {
namespace mobilemessage {
/* static */ already_AddRefed<nsISmsService>
SmsServicesFactory::CreateSmsService()
{
nsCOMPtr<nsISmsService> smsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
smsService = new SmsIPCService();
} else {
#ifdef MOZ_WIDGET_ANDROID
smsService = new SmsService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
smsService = new SmsService();
#endif
}
return smsService.forget();
}
/* static */ already_AddRefed<nsIMobileMessageDatabaseService>
SmsServicesFactory::CreateMobileMessageDatabaseService()
{
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mobileMessageDBService = new SmsIPCService();
} else {
#ifdef MOZ_WIDGET_ANDROID
mobileMessageDBService = new MobileMessageDatabaseService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mobileMessageDBService = do_GetService(RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
#endif
}
return mobileMessageDBService.forget();
}
/* static */ already_AddRefed<nsIMmsService>
SmsServicesFactory::CreateMmsService()
{
nsCOMPtr<nsIMmsService> mmsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mmsService = new SmsIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mmsService = do_CreateInstance(RIL_MMSSERVICE_CONTRACTID);
#endif
}
return mmsService.forget();
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,31 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_mobilemessage_SmsServicesFactory_h
#define mozilla_dom_mobilemessage_SmsServicesFactory_h
#include "nsCOMPtr.h"
class nsISmsService;
class nsIMmsService;
class nsIMobileMessageDatabaseService;
namespace mozilla {
namespace dom {
namespace mobilemessage {
class SmsServicesFactory
{
public:
static already_AddRefed<nsISmsService> CreateSmsService();
static already_AddRefed<nsIMobileMessageDatabaseService> CreateMobileMessageDatabaseService();
static already_AddRefed<nsIMmsService> CreateMmsService();
};
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_SmsServicesFactory_h

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

@ -3,7 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIMobileMessageCallback;
interface nsIDOMBlob;
@ -29,10 +28,3 @@ interface nsIMmsService : nsISupports
in DOMString toAddress,
in DOMString iccId);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMmsService>
NS_CreateMmsService();
%}

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

@ -46,10 +46,3 @@ interface nsIMobileMessageDatabaseService : nsISupports
nsICursorContinueCallback createThreadCursor(in nsIMobileMessageCursorCallback callback);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMobileMessageDatabaseService>
NS_CreateMobileMessageDatabaseService();
%}

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

@ -64,10 +64,3 @@ interface nsIMobileMessageService : nsISupports
[array, size_is(threadCount)] in unsigned long long threadIds,
in uint32_t threadCount);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMobileMessageService>
NS_CreateMobileMessageService();
%}

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

@ -34,13 +34,6 @@ interface nsIRilMobileMessageDatabaseConcatenationCallback : nsISupports
void notify(in nsresult aRv, in jsval aCompleteMessage);
};
%{C++
#define RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CID \
{ 0x29785f90, 0x6b5b, 0x11e2, { 0x92, 0x01, 0x3b, 0x28, 0x01, 0x70, 0xb2, 0xec } }
#define RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID \
"@mozilla.org/mobilemessage/rilmobilemessagedatabaseservice;1"
%}
[scriptable, uuid(0b437a5c-a2bc-11e3-bd1b-dbb173eb35f8)]
interface nsIRilMobileMessageDatabaseService : nsIMobileMessageDatabaseService
{

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

@ -33,10 +33,3 @@ interface nsISmsService : nsISupports
void getSmscAddress(in unsigned long serviceId,
in nsIMobileMessageCallback request);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsISmsService>
NS_CreateSmsService();
%}

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

@ -32,9 +32,6 @@ const char* kObservedPrefs[] = {
// TODO: Bug 767082 - WebSMS: sSmsChild leaks at shutdown
PSmsChild* gSmsChild;
// SmsIPCService is owned by nsLayoutModule.
SmsIPCService* sSingleton = nullptr;
PSmsChild*
GetSmsChild()
{
@ -105,19 +102,6 @@ NS_IMPL_ISUPPORTS(SmsIPCService,
nsIMobileMessageDatabaseService,
nsIObserver)
/* static */ already_AddRefed<SmsIPCService>
SmsIPCService::GetSingleton()
{
MOZ_ASSERT(NS_IsMainThread());
if (!sSingleton) {
sSingleton = new SmsIPCService();
}
nsRefPtr<SmsIPCService> service = sSingleton;
return service.forget();
}
SmsIPCService::SmsIPCService()
{
Preferences::AddStrongObservers(this, kObservedPrefs);
@ -125,11 +109,6 @@ SmsIPCService::SmsIPCService()
mSmsDefaultServiceId = getDefaultServiceId(kPrefSmsDefaultServiceId);
}
SmsIPCService::~SmsIPCService()
{
sSingleton = nullptr;
}
/*
* Implementation of nsIObserver.
*/

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

@ -30,14 +30,10 @@ public:
NS_DECL_NSIMOBILEMESSAGEDATABASESERVICE
NS_DECL_NSIOBSERVER
static already_AddRefed<SmsIPCService>
GetSingleton();
private:
SmsIPCService();
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~SmsIPCService();
private:
~SmsIPCService() {}
uint32_t mMmsDefaultServiceId;
uint32_t mSmsDefaultServiceId;

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

@ -13,6 +13,8 @@ EXPORTS.mozilla.dom.mobilemessage += [
'Constants.h', # Required by almost all cpp files
'ipc/SmsChild.h',
'ipc/SmsParent.h',
'MobileMessageService.h', # Required by nsLayoutModule.cpp
'SmsServicesFactory.h', # Required by nsLayoutModule.cpp
'Types.h', # Required by IPDL SmsTypes.h
]
@ -60,6 +62,7 @@ UNIFIED_SOURCES += [
'MobileMessageService.cpp',
'MobileMessageThread.cpp',
'SmsMessage.cpp',
'SmsServicesFactory.cpp',
]
IPDL_SOURCES += [

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

@ -26,13 +26,6 @@
#include "TelephonyCallGroup.h"
#include "TelephonyCallId.h"
// Service instantiation
#include "ipc/TelephonyIPCService.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkTelephonyService.h"
#endif
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
using namespace mozilla::dom;
using mozilla::ErrorResult;
@ -745,19 +738,3 @@ Telephony::EnqueueEnumerationAck(const nsAString& aType)
NS_WARNING("Failed to dispatch to current thread!");
}
}
already_AddRefed<nsITelephonyService>
NS_CreateTelephonyService()
{
nsCOMPtr<nsITelephonyService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = new mozilla::dom::telephony::TelephonyIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
service = do_CreateInstance(GONK_TELEPHONY_SERVICE_CONTRACTID);
#endif
}
return service.forget();
}

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

@ -0,0 +1,30 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/telephony/TelephonyFactory.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkTelephonyService.h"
#endif
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
#include "ipc/TelephonyIPCService.h"
USING_TELEPHONY_NAMESPACE
/* static */ already_AddRefed<nsITelephonyService>
TelephonyFactory::CreateTelephonyService()
{
nsCOMPtr<nsITelephonyService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = new TelephonyIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {
service = do_CreateInstance(GONK_TELEPHONY_SERVICE_CONTRACTID);
#endif
}
return service.forget();
}

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

@ -0,0 +1,24 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_telephony_TelephonyFactory_h
#define mozilla_dom_telephony_TelephonyFactory_h
#include "nsCOMPtr.h"
#include "mozilla/dom/telephony/TelephonyCommon.h"
class nsITelephonyService;
BEGIN_TELEPHONY_NAMESPACE
class TelephonyFactory
{
public:
static already_AddRefed<nsITelephonyService> CreateTelephonyService();
};
END_TELEPHONY_NAMESPACE
#endif // mozilla_dom_telephony_TelephonyFactory_h

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

@ -22,6 +22,7 @@ EXPORTS.mozilla.dom.telephony += [
'ipc/TelephonyChild.h',
'ipc/TelephonyParent.h',
'TelephonyCommon.h',
'TelephonyFactory.h',
]
UNIFIED_SOURCES += [
@ -33,6 +34,7 @@ UNIFIED_SOURCES += [
'TelephonyCall.cpp',
'TelephonyCallGroup.cpp',
'TelephonyCallId.cpp',
'TelephonyFactory.cpp',
]
IPDL_SOURCES += [

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

@ -265,10 +265,3 @@ interface nsITelephonyService : nsISupports
attribute bool microphoneMuted;
attribute bool speakerEnabled;
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsITelephonyService>
NS_CreateTelephonyService();
%}

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

@ -125,6 +125,15 @@ using mozilla::dom::gonk::AudioManager;
using mozilla::system::nsVolumeService;
#endif
#ifdef MOZ_B2G_RIL
#include "nsIMobileConnectionService.h"
#include "mozilla/dom/mobileconnection/MobileConnectionIPCService.h"
using mozilla::dom::mobileconnection::MobileConnectionIPCService;
#ifdef MOZ_WIDGET_GONK
#include "nsIGonkMobileConnectionService.h"
#endif
#endif
#include "AudioChannelAgent.h"
using mozilla::dom::AudioChannelAgent;
@ -216,9 +225,10 @@ static void Shutdown();
#include "nsCSPContext.h"
#include "nsISmsService.h"
#include "nsIMmsService.h"
#include "nsIMobileConnectionService.h"
#include "nsIMobileMessageService.h"
#include "nsIMobileMessageDatabaseService.h"
#include "mozilla/dom/mobilemessage/MobileMessageService.h"
#include "mozilla/dom/mobilemessage/SmsServicesFactory.h"
#include "nsIPowerManagerService.h"
#include "nsIAlarmHalService.h"
#include "nsIMediaManager.h"
@ -233,6 +243,7 @@ static void Shutdown();
#include "mozilla/dom/time/TimeService.h"
#include "StreamingProtocolService.h"
#include "mozilla/dom/telephony/TelephonyFactory.h"
#include "nsITelephonyService.h"
#ifdef MOZ_WIDGET_GONK
@ -244,6 +255,8 @@ static void Shutdown();
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::mobilemessage;
using namespace mozilla::dom::telephony;
using mozilla::dom::alarm::AlarmHalService;
using mozilla::dom::power::PowerManagerService;
using mozilla::dom::quota::QuotaManager;
@ -317,12 +330,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
#endif
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService, NS_CreateSmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMmsService, NS_CreateMmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService,
SmsServicesFactory::CreateSmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMmsService,
SmsServicesFactory::CreateMmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageService,
NS_CreateMobileMessageService)
MobileMessageService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageDatabaseService,
NS_CreateMobileMessageDatabaseService)
SmsServicesFactory::CreateMobileMessageDatabaseService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
PowerManagerService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIAlarmHalService,
@ -348,10 +363,8 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileConnectionService,
NS_CreateMobileConnectionService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyService,
NS_CreateTelephonyService)
TelephonyFactory::CreateTelephonyService)
//-----------------------------------------------------------------------------
@ -793,7 +806,9 @@ NS_DEFINE_NAMED_CID(TELEPHONY_SERVICE_CID);
NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
#ifdef MOZ_B2G_RIL
NS_DEFINE_NAMED_CID(NS_MOBILE_CONNECTION_SERVICE_CID);
#endif
static nsresult
CreateWindowCommandTableConstructor(nsISupports *aOuter,
@ -923,6 +938,31 @@ nsEditingCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
return commandTable->QueryInterface(aIID, aResult);
}
#ifdef MOZ_B2G_RIL
static nsresult
nsIMobileConnectionServiceConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
nsCOMPtr<nsIMobileConnectionService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = MobileConnectionIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_GONK
service = do_CreateInstance(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
#endif
}
if (!service) {
return NS_ERROR_NOT_AVAILABLE;
}
return service->QueryInterface(aIID, aResult);
}
#endif
static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
XPCONNECT_CIDENTRIES
#ifdef DEBUG
@ -1078,7 +1118,9 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
#endif
{ &kTELEPHONY_SERVICE_CID, false, nullptr, nsITelephonyServiceConstructor },
{ &kNS_MOBILE_CONNECTION_SERVICE_CID, false, NULL, nsIMobileConnectionServiceConstructor },
#ifdef MOZ_B2G_RIL
{ &kNS_MOBILE_CONNECTION_SERVICE_CID, true, NULL, nsIMobileConnectionServiceConstructor },
#endif
{ nullptr }
};
@ -1236,7 +1278,9 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
#endif
{ TELEPHONY_SERVICE_CONTRACTID, &kTELEPHONY_SERVICE_CID },
{ "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
#ifdef MOZ_B2G_RIL
{ NS_MOBILE_CONNECTION_SERVICE_CONTRACTID, &kNS_MOBILE_CONNECTION_SERVICE_CID },
#endif
{ nullptr }
};
@ -1259,7 +1303,9 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
#ifdef MOZ_B2G_BT
{ "profile-after-change", "Bluetooth Service", BLUETOOTHSERVICE_CONTRACTID },
#endif
#ifdef MOZ_B2G_RIL
{ "profile-after-change", "MobileConnection Service", NS_MOBILE_CONNECTION_SERVICE_CONTRACTID },
#endif
{ nullptr }
};