Bug 864485 - 2/3: DOM & IPC. r=khuey

This commit is contained in:
Vicamo Yang 2013-09-04 12:46:01 +08:00
parent aab4f60f6b
commit c0dad73b20
31 changed files with 1242 additions and 45 deletions

View File

@ -164,7 +164,6 @@
@BINPATH@/components/dom_base.xpt
@BINPATH@/components/dom_system.xpt
#ifdef MOZ_B2G_RIL
@BINPATH@/components/dom_telephony.xpt
@BINPATH@/components/dom_voicemail.xpt
@BINPATH@/components/dom_wifi.xpt
@BINPATH@/components/dom_system_gonk.xpt
@ -203,6 +202,7 @@
@BINPATH@/components/dom_mobilemessage.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_telephony.xpt
@BINPATH@/components/dom_threads.xpt
@BINPATH@/components/dom_traversal.xpt
@BINPATH@/components/dom_views.xpt

View File

@ -176,7 +176,6 @@
@BINPATH@/components/dom_base.xpt
@BINPATH@/components/dom_system.xpt
#ifdef MOZ_B2G_RIL
@BINPATH@/components/dom_telephony.xpt
@BINPATH@/components/dom_voicemail.xpt
@BINPATH@/components/dom_wifi.xpt
@BINPATH@/components/dom_system_gonk.xpt
@ -212,6 +211,7 @@
@BINPATH@/components/dom_mobilemessage.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_telephony.xpt
@BINPATH@/components/dom_traversal.xpt
#ifdef MOZ_WEBSPEECH
@BINPATH@/components/dom_webspeechrecognition.xpt

View File

@ -54,7 +54,7 @@
#include "MediaManager.h"
#endif
#ifdef MOZ_B2G_RIL
#include "Telephony.h"
#include "mozilla/dom/telephony/Telephony.h"
#endif
#ifdef MOZ_B2G_BT
#include "BluetoothManager.h"

View File

@ -168,12 +168,12 @@ DOMInterfaces = {
'CallEvent': {
'nativeType': 'mozilla::dom::telephony::CallEvent',
'headerFile': 'CallEvent.h',
'headerFile': 'mozilla/dom/telephony/CallEvent.h',
},
'CallsList': {
'nativeType': 'mozilla::dom::telephony::CallsList',
'headerFile': 'CallsList.h',
'headerFile': 'mozilla/dom/telephony/CallsList.h',
},
'CameraControl': {
@ -1162,17 +1162,17 @@ DOMInterfaces = {
'Telephony' : {
'nativeType': 'mozilla::dom::telephony::Telephony',
'headerFile': 'Telephony.h',
'headerFile': 'mozilla/dom/telephony/Telephony.h',
},
'TelephonyCall' : {
'nativeType': 'mozilla::dom::telephony::TelephonyCall',
'headerFile': 'TelephonyCall.h',
'headerFile': 'mozilla/dom/telephony/TelephonyCall.h',
},
'TelephonyCallGroup' : {
'nativeType': 'mozilla::dom::telephony::TelephonyCallGroup',
'headerFile': 'TelephonyCallGroup.h',
'headerFile': 'mozilla/dom/telephony/TelephonyCallGroup.h',
},
'Text': {

View File

@ -1479,7 +1479,7 @@ BluetoothHfpManager::OnConnectSuccess(BluetoothSocket* aSocket)
}
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE_VOID(provider);
provider->EnumerateCalls(mListener->GetListener());

View File

@ -61,13 +61,11 @@ TelephonyListener::EnumerateCallState(uint32_t aCallIndex,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference,
bool* aResult)
bool aIsConference)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber,
aIsOutgoing, false);
*aResult = true;
return NS_OK;
}
@ -117,10 +115,10 @@ bool
BluetoothTelephonyListener::StartListening()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, false);
nsresult rv = provider->RegisterTelephonyMsg(mTelephonyListener);
nsresult rv = provider->RegisterListener(mTelephonyListener);
NS_ENSURE_SUCCESS(rv, false);
return true;
@ -130,10 +128,10 @@ bool
BluetoothTelephonyListener::StopListening()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, false);
nsresult rv = provider->UnregisterTelephonyMsg(mTelephonyListener);
nsresult rv = provider->UnregisterListener(mTelephonyListener);
return NS_FAILED(rv) ? false : true;
}

View File

@ -40,7 +40,6 @@ DOM_SRCDIRS = \
ifdef MOZ_B2G_RIL
DOM_SRCDIRS += \
dom/system/gonk \
dom/telephony \
dom/wifi \
dom/icc/src \
$(NULL)

View File

@ -96,6 +96,7 @@
#include "mozilla/dom/indexedDB/PIndexedDBChild.h"
#include "mozilla/dom/mobilemessage/SmsChild.h"
#include "mozilla/dom/telephony/TelephonyChild.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
#include "mozilla/dom/bluetooth/PBluetoothChild.h"
#include "mozilla/dom/PFMRadioChild.h"
@ -126,6 +127,7 @@ using namespace mozilla::dom::devicestorage;
using namespace mozilla::dom::ipc;
using namespace mozilla::dom::mobilemessage;
using namespace mozilla::dom::indexedDB;
using namespace mozilla::dom::telephony;
using namespace mozilla::hal_sandbox;
using namespace mozilla::ipc;
using namespace mozilla::layers;
@ -919,6 +921,19 @@ ContentChild::DeallocPSmsChild(PSmsChild* aSms)
return true;
}
PTelephonyChild*
ContentChild::AllocPTelephonyChild()
{
MOZ_CRASH("No one should be allocating PTelephonyChild actors");
}
bool
ContentChild::DeallocPTelephonyChild(PTelephonyChild* aActor)
{
delete aActor;
return true;
}
PStorageChild*
ContentChild::AllocPStorageChild()
{

View File

@ -152,6 +152,9 @@ public:
virtual PSmsChild* AllocPSmsChild();
virtual bool DeallocPSmsChild(PSmsChild*);
virtual PTelephonyChild* AllocPTelephonyChild();
virtual bool DeallocPTelephonyChild(PTelephonyChild*);
virtual PStorageChild* AllocPStorageChild();
virtual bool DeallocPStorageChild(PStorageChild* aActor);

View File

@ -34,6 +34,7 @@
#include "mozilla/dom/bluetooth/PBluetoothParent.h"
#include "mozilla/dom/PFMRadioParent.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
#include "mozilla/dom/telephony/TelephonyParent.h"
#include "SmsParent.h"
#include "mozilla/Hal.h"
#include "mozilla/hal_sandbox/PHalParent.h"
@ -147,6 +148,7 @@ using namespace mozilla::dom::devicestorage;
using namespace mozilla::dom::indexedDB;
using namespace mozilla::dom::power;
using namespace mozilla::dom::mobilemessage;
using namespace mozilla::dom::telephony;
using namespace mozilla::hal;
using namespace mozilla::idl;
using namespace mozilla::ipc;
@ -2246,6 +2248,25 @@ ContentParent::DeallocPSmsParent(PSmsParent* aSms)
return true;
}
PTelephonyParent*
ContentParent::AllocPTelephonyParent()
{
if (!AssertAppProcessPermission(this, "telephony")) {
return nullptr;
}
TelephonyParent* actor = new TelephonyParent();
NS_ADDREF(actor);
return actor;
}
bool
ContentParent::DeallocPTelephonyParent(PTelephonyParent* aActor)
{
static_cast<TelephonyParent*>(aActor)->Release();
return true;
}
PStorageParent*
ContentParent::AllocPStorageParent()
{

View File

@ -321,6 +321,9 @@ private:
virtual PSmsParent* AllocPSmsParent();
virtual bool DeallocPSmsParent(PSmsParent*);
virtual PTelephonyParent* AllocPTelephonyParent();
virtual bool DeallocPTelephonyParent(PTelephonyParent*);
virtual PStorageParent* AllocPStorageParent();
virtual bool DeallocPStorageParent(PStorageParent* aActor);

View File

@ -33,7 +33,6 @@ LOCAL_INCLUDES += $(VPATH:%=-I%)
ifdef MOZ_B2G_RIL
LOCAL_INCLUDES += \
-I$(topsrcdir)/dom/telephony \
-I$(topsrcdir)/dom/system/gonk \
$(NULL)
endif

View File

@ -72,7 +72,8 @@ PARALLEL_DIRS += [
'camera',
'audiochannel',
'promise',
'wappush'
'wappush',
'telephony',
]
if CONFIG['OS_ARCH'] == 'WINNT':
@ -80,7 +81,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
if CONFIG['MOZ_B2G_RIL']:
PARALLEL_DIRS += [
'telephony',
'wifi',
'icc',
'cellbroadcast',

View File

@ -26,7 +26,6 @@ include $(topsrcdir)/dom/dom-config.mk
LOCAL_INCLUDES = \
-I$(topsrcdir)/dom/base \
-I$(topsrcdir)/dom/src/geolocation \
-I$(topsrcdir)/dom/telephony \
-I$(topsrcdir)/dom/wifi \
-I$(topsrcdir)/dom/bluetooth \
-I$(topsrcdir)/content/events/src \

View File

@ -11,6 +11,7 @@
USING_TELEPHONY_NAMESPACE
using namespace mozilla::dom;
using mozilla::ErrorResult;
/* static */
already_AddRefed<CallEvent>

View File

@ -5,11 +5,18 @@
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
VPATH = \
$(srcdir) \
$(srcdir)/ipc \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/dom/dom-config.mk
include $(topsrcdir)/config/rules.mk
# Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
# subdirectory (and the ipc one).
LOCAL_INCLUDES = $(VPATH:%=-I%)
include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk

View File

@ -24,10 +24,9 @@
#include "TelephonyCall.h"
#include "TelephonyCallGroup.h"
#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
USING_TELEPHONY_NAMESPACE
using namespace mozilla::dom;
using mozilla::ErrorResult;
namespace {
@ -51,6 +50,8 @@ public:
MOZ_ASSERT(mTelephony);
}
virtual ~Listener() {}
void
Disconnect()
{
@ -111,7 +112,7 @@ Telephony::Shutdown()
mListener->Disconnect();
if (mProvider) {
mProvider->UnregisterTelephonyMsg(mListener);
mProvider->UnregisterListener(mListener);
mProvider = nullptr;
}
@ -132,7 +133,7 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv)
NS_ASSERTION(aOwner, "Null owner!");
nsCOMPtr<nsITelephonyProvider> ril =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
if (!ril) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
@ -165,7 +166,7 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv)
return nullptr;
}
rv = ril->RegisterTelephonyMsg(telephony->mListener);
rv = ril->RegisterListener(telephony->mListener);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
@ -222,12 +223,7 @@ Telephony::DialInternal(bool isEmergency,
}
}
nsresult rv;
if (isEmergency) {
rv = mProvider->DialEmergency(aNumber);
} else {
rv = mProvider->Dial(aNumber);
}
nsresult rv = mProvider->Dial(aNumber, isEmergency);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
@ -591,7 +587,7 @@ NS_IMETHODIMP
Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState,
const nsAString& aNumber, bool aIsActive,
bool aIsOutgoing, bool aIsEmergency,
bool aIsConference, bool* aContinue)
bool aIsConference)
{
nsRefPtr<TelephonyCall> call;
@ -603,12 +599,10 @@ Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState,
call = aIsConference ? mGroup->GetCall(aCallIndex) : GetCall(aCallIndex);
if (call) {
// We have the call either in mCalls or in mGroup. Skip it.
*aContinue = true;
return NS_OK;
}
if (MoveCall(aCallIndex, aIsConference)) {
*aContinue = true;
return NS_OK;
}
@ -622,7 +616,6 @@ Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState,
mCalls.Contains(call),
"Should have auto-added new call!");
*aContinue = true;
return NS_OK;
}

View File

@ -15,6 +15,7 @@
USING_TELEPHONY_NAMESPACE
using namespace mozilla::dom;
using mozilla::ErrorResult;
// static
already_AddRefed<TelephonyCall>

View File

@ -13,6 +13,7 @@
USING_TELEPHONY_NAMESPACE
using namespace mozilla::dom;
using mozilla::ErrorResult;
TelephonyCallGroup::TelephonyCallGroup()
: mCallState(nsITelephonyProvider::CALL_STATE_UNKNOWN)

View File

@ -0,0 +1,23 @@
/* -*- 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"
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
#include "TelephonyIPCProvider.h"
USING_TELEPHONY_NAMESPACE
/* static */ already_AddRefed<nsITelephonyProvider>
TelephonyFactory::CreateTelephonyProvider()
{
nsCOMPtr<nsITelephonyProvider> provider;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
provider = new TelephonyIPCProvider();
}
return provider.forget();
}

View File

@ -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 nsITelephonyProvider;
BEGIN_TELEPHONY_NAMESPACE
class TelephonyFactory
{
public:
static already_AddRefed<nsITelephonyProvider> CreateTelephonyProvider();
};
END_TELEPHONY_NAMESPACE
#endif // mozilla_dom_telephony_TelephonyFactory_h

View File

@ -0,0 +1,131 @@
/* -*- 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 "TelephonyChild.h"
#include "nsITelephonyProvider.h"
USING_TELEPHONY_NAMESPACE
/*******************************************************************************
* TelephonyChild
******************************************************************************/
TelephonyChild::TelephonyChild(nsITelephonyListener* aListener)
: mListener(aListener)
{
MOZ_ASSERT(aListener);
}
void
TelephonyChild::ActorDestroy(ActorDestroyReason aWhy)
{
mListener = nullptr;
}
PTelephonyRequestChild*
TelephonyChild::AllocPTelephonyRequestChild()
{
MOZ_CRASH("Caller is supposed to manually construct a request!");
}
bool
TelephonyChild::DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor)
{
delete aActor;
return true;
}
bool
TelephonyChild::RecvNotifyCallError(const int32_t& aCallIndex,
const nsString& aError)
{
MOZ_ASSERT(mListener);
mListener->NotifyError(aCallIndex, aError);
return true;
}
bool
TelephonyChild::RecvNotifyCallStateChanged(const IPCCallStateData& aData)
{
MOZ_ASSERT(mListener);
mListener->CallStateChanged(aData.callIndex(),
aData.callState(),
aData.number(),
aData.isActive(),
aData.isOutGoing(),
aData.isEmergency(),
aData.isConference());
return true;
}
bool
TelephonyChild::RecvNotifyCdmaCallWaiting(const nsString& aNumber)
{
MOZ_ASSERT(mListener);
mListener->NotifyCdmaCallWaiting(aNumber);
return true;
}
bool
TelephonyChild::RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState)
{
MOZ_ASSERT(mListener);
mListener->ConferenceCallStateChanged(aCallState);
return true;
}
bool
TelephonyChild::RecvNotifySupplementaryService(const int32_t& aCallIndex,
const uint16_t& aNotification)
{
MOZ_ASSERT(mListener);
mListener->SupplementaryServiceNotification(aCallIndex, aNotification);
return true;
}
/*******************************************************************************
* TelephonyRequestChild
******************************************************************************/
TelephonyRequestChild::TelephonyRequestChild(nsITelephonyListener* aListener)
: mListener(aListener)
{
MOZ_ASSERT(aListener);
}
void
TelephonyRequestChild::ActorDestroy(ActorDestroyReason aWhy)
{
mListener = nullptr;
}
bool
TelephonyRequestChild::Recv__delete__()
{
MOZ_ASSERT(mListener);
mListener->EnumerateCallStateComplete();
return true;
}
bool
TelephonyRequestChild::RecvNotifyEnumerateCallState(const IPCCallStateData& aData)
{
MOZ_ASSERT(mListener);
mListener->EnumerateCallState(aData.callIndex(),
aData.callState(),
aData.number(),
aData.isActive(),
aData.isOutGoing(),
aData.isEmergency(),
aData.isConference());
return true;
}

View File

@ -0,0 +1,78 @@
/* -*- 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_TelephonyChild_h
#define mozilla_dom_telephony_TelephonyChild_h
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "mozilla/dom/telephony/PTelephonyChild.h"
#include "mozilla/dom/telephony/PTelephonyRequestChild.h"
class nsITelephonyListener;
BEGIN_TELEPHONY_NAMESPACE
class TelephonyChild : public PTelephonyChild
{
public:
TelephonyChild(nsITelephonyListener* aListener);
protected:
virtual ~TelephonyChild() {}
virtual void
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
virtual PTelephonyRequestChild*
AllocPTelephonyRequestChild() MOZ_OVERRIDE;
virtual bool
DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor) MOZ_OVERRIDE;
virtual bool
RecvNotifyCallError(const int32_t& aCallIndex,
const nsString& aError) MOZ_OVERRIDE;
virtual bool
RecvNotifyCallStateChanged(const IPCCallStateData& aData) MOZ_OVERRIDE;
virtual bool
RecvNotifyCdmaCallWaiting(const nsString& aNumber) MOZ_OVERRIDE;
virtual bool
RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState) MOZ_OVERRIDE;
virtual bool
RecvNotifySupplementaryService(const int32_t& aCallIndex,
const uint16_t& aNotification) MOZ_OVERRIDE;
private:
nsCOMPtr<nsITelephonyListener> mListener;
};
class TelephonyRequestChild : public PTelephonyRequestChild
{
public:
TelephonyRequestChild(nsITelephonyListener* aListener);
protected:
virtual ~TelephonyRequestChild() {}
virtual void
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
virtual bool
Recv__delete__() MOZ_OVERRIDE;
virtual bool
RecvNotifyEnumerateCallState(const IPCCallStateData& aData) MOZ_OVERRIDE;
private:
nsCOMPtr<nsITelephonyListener> mListener;
};
END_TELEPHONY_NAMESPACE
#endif // mozilla_dom_telephony_TelephonyChild_h

View File

@ -0,0 +1,258 @@
/* -*- 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/ContentChild.h"
#include "TelephonyChild.h"
#include "TelephonyIPCProvider.h"
USING_TELEPHONY_NAMESPACE
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS2(TelephonyIPCProvider,
nsITelephonyProvider,
nsITelephonyListener)
TelephonyIPCProvider::TelephonyIPCProvider()
{
// Deallocated in ContentChild::DeallocPTelephonyChild().
mPTelephonyChild = new TelephonyChild(this);
ContentChild::GetSingleton()->SendPTelephonyConstructor(mPTelephonyChild);
}
TelephonyIPCProvider::~TelephonyIPCProvider()
{
mPTelephonyChild->Send__delete__(mPTelephonyChild);
mPTelephonyChild = nullptr;
}
/*
* Implementation of nsITelephonyProvider.
*/
NS_IMETHODIMP
TelephonyIPCProvider::RegisterListener(nsITelephonyListener *aListener)
{
MOZ_ASSERT(!mListeners.Contains(aListener));
// nsTArray doesn't fail.
mListeners.AppendElement(aListener);
if (mListeners.Length() == 1) {
mPTelephonyChild->SendRegisterListener();
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::UnregisterListener(nsITelephonyListener *aListener)
{
MOZ_ASSERT(mListeners.Contains(aListener));
// We always have the element here, so it can't fail.
mListeners.RemoveElement(aListener);
if (!mListeners.Length()) {
mPTelephonyChild->SendUnregisterListener();
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCalls(nsITelephonyListener *aListener)
{
// Life time of newly allocated TelephonyRequestChild instance is managed by
// IPDL itself.
TelephonyRequestChild* actor = new TelephonyRequestChild(aListener);
mPTelephonyChild->SendPTelephonyRequestConstructor(actor);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::Dial(const nsAString& aNumber,
bool aIsEmergency)
{
mPTelephonyChild->SendDialCall(nsString(aNumber), aIsEmergency);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::HangUp(uint32_t aCallIndex)
{
mPTelephonyChild->SendHangUpCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::AnswerCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendAnswerCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::RejectCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendRejectCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::HoldCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendHoldCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ResumeCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendResumeCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ConferenceCall()
{
mPTelephonyChild->SendConferenceCall();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::SeparateCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendSeparateCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::HoldConference()
{
mPTelephonyChild->SendHoldConference();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ResumeConference()
{
mPTelephonyChild->SendResumeConference();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::StartTone(const nsAString& aDtmfChar)
{
mPTelephonyChild->SendStartTone(nsString(aDtmfChar));
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::StopTone()
{
mPTelephonyChild->SendStopTone();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::GetMicrophoneMuted(bool* aMuted)
{
mPTelephonyChild->SendGetMicrophoneMuted(aMuted);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::SetMicrophoneMuted(bool aMuted)
{
mPTelephonyChild->SendSetMicrophoneMuted(aMuted);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::GetSpeakerEnabled(bool* aEnabled)
{
mPTelephonyChild->SendGetSpeakerEnabled(aEnabled);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::SetSpeakerEnabled(bool aEnabled)
{
mPTelephonyChild->SendSetSpeakerEnabled(aEnabled);
return NS_OK;
}
// nsITelephonyListener
NS_IMETHODIMP
TelephonyIPCProvider::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->CallStateChanged(aCallIndex, aCallState, aNumber,
aIsActive, aIsOutgoing, aIsEmergency,
aIsConference);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ConferenceCallStateChanged(uint16_t aCallState)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->ConferenceCallStateChanged(aCallState);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCallStateComplete()
{
MOZ_CRASH("Not a EnumerateCalls request!");
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
MOZ_CRASH("Not a EnumerateCalls request!");
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->NotifyCdmaCallWaiting(aNumber);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->NotifyError(aCallIndex, aError);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->SupplementaryServiceNotification(aCallIndex, aNotification);
}
return NS_OK;
}

View File

@ -0,0 +1,37 @@
/* -*- 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_TelephonyIPCProvider_h
#define mozilla_dom_telephony_TelephonyIPCProvider_h
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "mozilla/Attributes.h"
#include "nsITelephonyProvider.h"
BEGIN_TELEPHONY_NAMESPACE
class PTelephonyChild;
class TelephonyIPCProvider MOZ_FINAL : public nsITelephonyProvider
, public nsITelephonyListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITELEPHONYPROVIDER
NS_DECL_NSITELEPHONYLISTENER
TelephonyIPCProvider();
protected:
virtual ~TelephonyIPCProvider();
private:
nsTArray<nsCOMPtr<nsITelephonyListener> > mListeners;
PTelephonyChild* mPTelephonyChild;
};
END_TELEPHONY_NAMESPACE
#endif // mozilla_dom_telephony_TelephonyIPCProvider_h

View File

@ -0,0 +1,448 @@
/* -*- 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 "TelephonyParent.h"
USING_TELEPHONY_NAMESPACE
/*******************************************************************************
* TelephonyParent
******************************************************************************/
NS_IMPL_ISUPPORTS1(TelephonyParent, nsITelephonyListener)
TelephonyParent::TelephonyParent()
: mActorDestroyed(false)
, mRegistered(false)
{
}
void
TelephonyParent::ActorDestroy(ActorDestroyReason why)
{
// The child process could die before this asynchronous notification, in which
// case ActorDestroy() was called and mActorDestroyed is set to true. Return
// an error here to avoid sending a message to the dead process.
mActorDestroyed = true;
// Try to unregister listener if we're still registered.
RecvUnregisterListener();
}
bool
TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActor)
{
TelephonyRequestParent* actor = static_cast<TelephonyRequestParent*>(aActor);
return actor->DoRequest();
}
PTelephonyRequestParent*
TelephonyParent::AllocPTelephonyRequestParent()
{
TelephonyRequestParent* actor = new TelephonyRequestParent();
// Add an extra ref for IPDL. Will be released in
// TelephonyParent::DeallocPTelephonyRequestParent().
NS_ADDREF(actor);
return actor;
}
bool
TelephonyParent::DeallocPTelephonyRequestParent(PTelephonyRequestParent* aActor)
{
// TelephonyRequestParent is refcounted, must not be freed manually.
static_cast<TelephonyRequestParent*>(aActor)->Release();
return true;
}
bool
TelephonyParent::Recv__delete__()
{
return true; // Unregister listener in TelephonyParent::ActorDestroy().
}
bool
TelephonyParent::RecvRegisterListener()
{
NS_ENSURE_TRUE(!mRegistered, true);
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
mRegistered = NS_SUCCEEDED(provider->RegisterListener(this));
return true;
}
bool
TelephonyParent::RecvUnregisterListener()
{
NS_ENSURE_TRUE(mRegistered, true);
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
mRegistered = !NS_SUCCEEDED(provider->UnregisterListener(this));
return true;
}
bool
TelephonyParent::RecvDialCall(const nsString& aNumber,
const bool& aIsEmergency)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->Dial(aNumber, aIsEmergency);
return true;
}
bool
TelephonyParent::RecvHangUpCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HangUp(aCallIndex);
return true;
}
bool
TelephonyParent::RecvAnswerCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->AnswerCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvRejectCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->RejectCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvHoldCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HoldCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvResumeCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ResumeCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvConferenceCall()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ConferenceCall();
return true;
}
bool
TelephonyParent::RecvSeparateCall(const uint32_t& aCallState)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SeparateCall(aCallState);
return true;
}
bool
TelephonyParent::RecvHoldConference()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HoldConference();
return true;
}
bool
TelephonyParent::RecvResumeConference()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ResumeConference();
return true;
}
bool
TelephonyParent::RecvStartTone(const nsString& aTone)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->StartTone(aTone);
return true;
}
bool
TelephonyParent::RecvStopTone()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->StopTone();
return true;
}
bool
TelephonyParent::RecvGetMicrophoneMuted(bool* aMuted)
{
*aMuted = false;
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->GetMicrophoneMuted(aMuted);
return true;
}
bool
TelephonyParent::RecvSetMicrophoneMuted(const bool& aMuted)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SetMicrophoneMuted(aMuted);
return true;
}
bool
TelephonyParent::RecvGetSpeakerEnabled(bool* aEnabled)
{
*aEnabled = false;
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->GetSpeakerEnabled(aEnabled);
return true;
}
bool
TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SetSpeakerEnabled(aEnabled);
return true;
}
// nsITelephonyListener
NS_IMETHODIMP
TelephonyParent::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), aIsActive,
aIsOutgoing, aIsEmergency, aIsConference);
return SendNotifyCallStateChanged(data) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::ConferenceCallStateChanged(uint16_t aCallState)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyConferenceCallStateChanged(aCallState) ? NS_OK
: NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::EnumerateCallStateComplete()
{
MOZ_CRASH("Not a EnumerateCalls request!");
}
NS_IMETHODIMP
TelephonyParent::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
MOZ_CRASH("Not a EnumerateCalls request!");
}
NS_IMETHODIMP
TelephonyParent::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyCdmaCallWaiting(nsString(aNumber)) ? NS_OK
: NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyCallError(aCallIndex, nsString(aError)) ? NS_OK
: NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifySupplementaryService(aCallIndex, aNotification)
? NS_OK : NS_ERROR_FAILURE;
}
/*******************************************************************************
* TelephonyRequestParent
******************************************************************************/
NS_IMPL_ISUPPORTS1(TelephonyRequestParent, nsITelephonyListener)
TelephonyRequestParent::TelephonyRequestParent()
: mActorDestroyed(false)
{
}
void
TelephonyRequestParent::ActorDestroy(ActorDestroyReason why)
{
// The child process could die before this asynchronous notification, in which
// case ActorDestroy() was called and mActorDestroyed is set to true. Return
// an error here to avoid sending a message to the dead process.
mActorDestroyed = true;
}
bool
TelephonyRequestParent::DoRequest()
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
if (provider) {
rv = provider->EnumerateCalls(this);
}
if (NS_FAILED(rv)) {
return NS_SUCCEEDED(EnumerateCallStateComplete());
}
return true;
}
// nsITelephonyListener
NS_IMETHODIMP
TelephonyRequestParent::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::ConferenceCallStateChanged(uint16_t aCallState)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::EnumerateCallStateComplete()
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return Send__delete__(this) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyRequestParent::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), aIsActive,
aIsOutgoing, aIsEmergency, aIsConference);
return SendNotifyEnumerateCallState(data) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyRequestParent::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
MOZ_CRASH("Not a TelephonyParent!");
}

View File

@ -0,0 +1,128 @@
/* -*- 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_TelephonyParent_h
#define mozilla_dom_telephony_TelephonyParent_h
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "mozilla/dom/telephony/PTelephonyParent.h"
#include "mozilla/dom/telephony/PTelephonyRequestParent.h"
#include "nsITelephonyProvider.h"
BEGIN_TELEPHONY_NAMESPACE
class TelephonyParent : public PTelephonyParent
, public nsITelephonyListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITELEPHONYLISTENER
TelephonyParent();
protected:
virtual ~TelephonyParent() {}
virtual void
ActorDestroy(ActorDestroyReason why);
virtual bool
RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActor) MOZ_OVERRIDE;
virtual PTelephonyRequestParent*
AllocPTelephonyRequestParent() MOZ_OVERRIDE;
virtual bool
DeallocPTelephonyRequestParent(PTelephonyRequestParent* aActor) MOZ_OVERRIDE;
virtual bool
Recv__delete__() MOZ_OVERRIDE;
virtual bool
RecvRegisterListener() MOZ_OVERRIDE;
virtual bool
RecvUnregisterListener() MOZ_OVERRIDE;
virtual bool
RecvDialCall(const nsString& aNumber,
const bool& aIsEmergency) MOZ_OVERRIDE;
virtual bool
RecvHangUpCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvAnswerCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvRejectCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvHoldCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvResumeCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvConferenceCall() MOZ_OVERRIDE;
virtual bool
RecvSeparateCall(const uint32_t& callIndex) MOZ_OVERRIDE;
virtual bool
RecvHoldConference() MOZ_OVERRIDE;
virtual bool
RecvResumeConference() MOZ_OVERRIDE;
virtual bool
RecvStartTone(const nsString& aTone) MOZ_OVERRIDE;
virtual bool
RecvStopTone() MOZ_OVERRIDE;
virtual bool
RecvGetMicrophoneMuted(bool* aMuted) MOZ_OVERRIDE;
virtual bool
RecvSetMicrophoneMuted(const bool& aMuted) MOZ_OVERRIDE;
virtual bool
RecvGetSpeakerEnabled(bool* aEnabled) MOZ_OVERRIDE;
virtual bool
RecvSetSpeakerEnabled(const bool& aEnabled) MOZ_OVERRIDE;
private:
bool mActorDestroyed;
bool mRegistered;
};
class TelephonyRequestParent : public PTelephonyRequestParent
, public nsITelephonyListener
{
friend class TelephonyParent;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITELEPHONYLISTENER
protected:
TelephonyRequestParent();
virtual ~TelephonyRequestParent() {}
virtual void
ActorDestroy(ActorDestroyReason why);
private:
bool mActorDestroyed;
bool
DoRequest();
};
END_TELEPHONY_NAMESPACE
#endif /* mozilla_dom_telephony_TelephonyParent_h */

View File

@ -12,12 +12,34 @@ XPIDL_MODULE = 'dom_telephony'
MODULE = 'dom'
EXPORTS.mozilla.dom.telephony += [
'CallEvent.h',
'CallsList.h',
'Telephony.h',
'TelephonyCall.h',
'TelephonyCallGroup.h',
'TelephonyCommon.h',
'TelephonyFactory.h',
'ipc/TelephonyChild.h',
'ipc/TelephonyParent.h',
]
CPP_SOURCES += [
'CallEvent.cpp',
'CallsList.cpp',
'Telephony.cpp',
'TelephonyCall.cpp',
'TelephonyCallGroup.cpp',
'TelephonyChild.cpp',
'TelephonyFactory.cpp',
'TelephonyIPCProvider.cpp',
'TelephonyParent.cpp',
]
IPDL_SOURCES += [
'ipc/PTelephony.ipdl',
'ipc/PTelephonyRequest.ipdl',
'ipc/TelephonyTypes.ipdlh'
]
FAIL_ON_WARNINGS = True
@ -25,4 +47,3 @@ FAIL_ON_WARNINGS = True
LIBXUL_LIBRARY = True
LIBRARY_NAME = 'domtelephony_s'

View File

@ -34,6 +34,8 @@ webidl_files = \
BiquadFilterNode.webidl \
Blob.webidl \
BrowserElementDictionaries.webidl \
CallEvent.webidl \
CallsList.webidl \
CameraControl.webidl \
CameraManager.webidl \
CanvasRenderingContext2D.webidl \
@ -359,6 +361,9 @@ webidl_files = \
SVGViewElement.webidl \
SVGZoomAndPan.webidl \
SVGZoomEvent.webidl \
Telephony.webidl \
TelephonyCall.webidl \
TelephonyCallGroup.webidl \
Text.webidl \
TextDecoder.webidl \
TextEncoder.webidl \
@ -445,12 +450,8 @@ endif
ifdef MOZ_B2G_RIL
webidl_files += \
CallsList.webidl \
MozStkCommandEvent.webidl \
MozVoicemail.webidl \
Telephony.webidl \
TelephonyCall.webidl \
TelephonyCallGroup.webidl \
$(NULL)
endif
@ -495,7 +496,6 @@ endif
ifdef MOZ_B2G_RIL
webidl_files += \
CallEvent.webidl \
CFStateChangeEvent.webidl \
DataErrorEvent.webidl \
IccCardLockErrorEvent.webidl \

View File

@ -66,6 +66,7 @@ SHARED_LIBRARY_LIBS = \
$(DEPTH)/dom/promise/$(LIB_PREFIX)dompromise_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/src/notification/$(LIB_PREFIX)jsdomnotification_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/system/$(LIB_PREFIX)domsystem_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/workers/$(LIB_PREFIX)domworkers_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/indexedDB/$(LIB_PREFIX)dom_indexeddb_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/indexedDB/ipc/$(LIB_PREFIX)dom_indexeddb_ipc_s.$(LIB_SUFFIX) \
@ -136,7 +137,6 @@ SHARED_LIBRARY_LIBS += $(DEPTH)/dom/camera/$(LIB_PREFIX)domcamera_s.$(LIB_SUFFIX
ifdef MOZ_B2G_RIL #{
SHARED_LIBRARY_LIBS += \
$(DEPTH)/dom/system/gonk/$(LIB_PREFIX)domsystemgonk_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/icc/src/$(LIB_PREFIX)dom_icc_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/cellbroadcast/src/$(LIB_PREFIX)dom_cellbroadcast_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/voicemail/$(LIB_PREFIX)domvoicemail_s.$(LIB_SUFFIX) \

View File

@ -230,6 +230,9 @@ static void Shutdown();
#include "mozilla/dom/alarm/AlarmHalService.h"
#include "mozilla/dom/time/TimeService.h"
#include "mozilla/dom/telephony/TelephonyFactory.h"
#include "nsITelephonyProvider.h"
#ifdef MOZ_WIDGET_GONK
#include "GonkGPSGeolocationProvider.h"
#endif
@ -238,6 +241,7 @@ 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::indexedDB::IndexedDatabaseManager;
using mozilla::dom::power::PowerManagerService;
@ -338,6 +342,8 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyProvider,
TelephonyFactory::CreateTelephonyProvider)
//-----------------------------------------------------------------------------
@ -811,6 +817,7 @@ NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID);
#ifdef ACCESSIBILITY
NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(TELEPHONY_PROVIDER_CID);
static nsresult
CreateWindowCommandTableConstructor(nsISupports *aOuter,
@ -1093,6 +1100,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
#ifdef ACCESSIBILITY
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, CreateA11yService },
#endif
{ &kTELEPHONY_PROVIDER_CID, false, NULL, nsITelephonyProviderConstructor },
{ NULL }
};
@ -1248,6 +1256,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
#endif
{ TELEPHONY_PROVIDER_CONTRACTID, &kTELEPHONY_PROVIDER_CID },
{ NULL }
};