From 983620f4cbddc2855d4c9ed1f3d392169f8b2fd1 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 4 Sep 2013 11:51:02 +0100 Subject: [PATCH] Backed out changeset 9bd4fcd6d084 (bug 864485) --- b2g/installer/package-manifest.in | 2 +- browser/installer/package-manifest.in | 2 +- dom/base/Navigator.cpp | 2 +- dom/bindings/Bindings.conf | 10 +- dom/bluetooth/BluetoothHfpManager.cpp | 2 +- dom/bluetooth/BluetoothTelephonyListener.cpp | 12 +- dom/dom-config.mk | 1 + dom/ipc/ContentChild.cpp | 15 - dom/ipc/ContentChild.h | 3 - dom/ipc/ContentParent.cpp | 21 - dom/ipc/ContentParent.h | 3 - dom/mobilemessage/src/Makefile.in | 1 + dom/moz.build | 4 +- dom/system/gonk/Makefile.in | 1 + dom/telephony/CallEvent.cpp | 1 - dom/telephony/Makefile.in | 11 +- dom/telephony/Telephony.cpp | 23 +- dom/telephony/TelephonyCall.cpp | 1 - dom/telephony/TelephonyCallGroup.cpp | 1 - dom/telephony/TelephonyFactory.cpp | 23 - dom/telephony/TelephonyFactory.h | 24 - dom/telephony/ipc/TelephonyChild.cpp | 130 ------ dom/telephony/ipc/TelephonyChild.h | 77 ---- dom/telephony/ipc/TelephonyIPCProvider.cpp | 258 ----------- dom/telephony/ipc/TelephonyIPCProvider.h | 37 -- dom/telephony/ipc/TelephonyParent.cpp | 448 ------------------- dom/telephony/ipc/TelephonyParent.h | 128 ------ dom/telephony/moz.build | 23 +- dom/webidl/WebIDL.mk | 10 +- layout/build/Makefile.in | 2 +- layout/build/nsLayoutModule.cpp | 9 - 31 files changed, 45 insertions(+), 1240 deletions(-) delete mode 100644 dom/telephony/TelephonyFactory.cpp delete mode 100644 dom/telephony/TelephonyFactory.h delete mode 100644 dom/telephony/ipc/TelephonyChild.cpp delete mode 100644 dom/telephony/ipc/TelephonyChild.h delete mode 100644 dom/telephony/ipc/TelephonyIPCProvider.cpp delete mode 100644 dom/telephony/ipc/TelephonyIPCProvider.h delete mode 100644 dom/telephony/ipc/TelephonyParent.cpp delete mode 100644 dom/telephony/ipc/TelephonyParent.h diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index adf1200a495..2553cf7659a 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -164,6 +164,7 @@ @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 @@ -202,7 +203,6 @@ @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 diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 387a7915c87..7842047d3bc 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -176,6 +176,7 @@ @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 @@ -211,7 +212,6 @@ @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 diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index afca9c5111e..45ba553271b 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -54,7 +54,7 @@ #include "MediaManager.h" #endif #ifdef MOZ_B2G_RIL -#include "mozilla/dom/telephony/Telephony.h" +#include "Telephony.h" #endif #ifdef MOZ_B2G_BT #include "BluetoothManager.h" diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 28f4b4d783d..280dec64d94 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -168,12 +168,12 @@ DOMInterfaces = { 'CallEvent': { 'nativeType': 'mozilla::dom::telephony::CallEvent', - 'headerFile': 'mozilla/dom/telephony/CallEvent.h', + 'headerFile': 'CallEvent.h', }, 'CallsList': { 'nativeType': 'mozilla::dom::telephony::CallsList', - 'headerFile': 'mozilla/dom/telephony/CallsList.h', + 'headerFile': 'CallsList.h', }, 'CameraControl': { @@ -1162,17 +1162,17 @@ DOMInterfaces = { 'Telephony' : { 'nativeType': 'mozilla::dom::telephony::Telephony', - 'headerFile': 'mozilla/dom/telephony/Telephony.h', + 'headerFile': 'Telephony.h', }, 'TelephonyCall' : { 'nativeType': 'mozilla::dom::telephony::TelephonyCall', - 'headerFile': 'mozilla/dom/telephony/TelephonyCall.h', + 'headerFile': 'TelephonyCall.h', }, 'TelephonyCallGroup' : { 'nativeType': 'mozilla::dom::telephony::TelephonyCallGroup', - 'headerFile': 'mozilla/dom/telephony/TelephonyCallGroup.h', + 'headerFile': 'TelephonyCallGroup.h', }, 'Text': { diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index 2df32818d00..99a7d68d741 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -1479,7 +1479,7 @@ BluetoothHfpManager::OnConnectSuccess(BluetoothSocket* aSocket) } nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); NS_ENSURE_TRUE_VOID(provider); provider->EnumerateCalls(mListener->GetListener()); diff --git a/dom/bluetooth/BluetoothTelephonyListener.cpp b/dom/bluetooth/BluetoothTelephonyListener.cpp index 93bfc84e676..eac3a431ba0 100644 --- a/dom/bluetooth/BluetoothTelephonyListener.cpp +++ b/dom/bluetooth/BluetoothTelephonyListener.cpp @@ -61,11 +61,13 @@ TelephonyListener::EnumerateCallState(uint32_t aCallIndex, bool aIsActive, bool aIsOutgoing, bool aIsEmergency, - bool aIsConference) + bool aIsConference, + bool* aResult) { BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber, aIsOutgoing, false); + *aResult = true; return NS_OK; } @@ -115,10 +117,10 @@ bool BluetoothTelephonyListener::StartListening() { nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); NS_ENSURE_TRUE(provider, false); - nsresult rv = provider->RegisterListener(mTelephonyListener); + nsresult rv = provider->RegisterTelephonyMsg(mTelephonyListener); NS_ENSURE_SUCCESS(rv, false); return true; @@ -128,10 +130,10 @@ bool BluetoothTelephonyListener::StopListening() { nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); NS_ENSURE_TRUE(provider, false); - nsresult rv = provider->UnregisterListener(mTelephonyListener); + nsresult rv = provider->UnregisterTelephonyMsg(mTelephonyListener); return NS_FAILED(rv) ? false : true; } diff --git a/dom/dom-config.mk b/dom/dom-config.mk index 6450d3c92a0..b001fc9d378 100644 --- a/dom/dom-config.mk +++ b/dom/dom-config.mk @@ -40,6 +40,7 @@ DOM_SRCDIRS = \ ifdef MOZ_B2G_RIL DOM_SRCDIRS += \ dom/system/gonk \ + dom/telephony \ dom/wifi \ dom/icc/src \ $(NULL) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index ceb98dd23f1..f1afd28ea2d 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -96,7 +96,6 @@ #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" @@ -127,7 +126,6 @@ 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; @@ -921,19 +919,6 @@ 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() { diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 4dd4d77e20b..279af64fb61 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -152,9 +152,6 @@ public: virtual PSmsChild* AllocPSmsChild(); virtual bool DeallocPSmsChild(PSmsChild*); - virtual PTelephonyChild* AllocPTelephonyChild(); - virtual bool DeallocPTelephonyChild(PTelephonyChild*); - virtual PStorageChild* AllocPStorageChild(); virtual bool DeallocPStorageChild(PStorageChild* aActor); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 7c2552b3cbb..320e465a627 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -34,7 +34,6 @@ #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" @@ -148,7 +147,6 @@ 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; @@ -2248,25 +2246,6 @@ 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(aActor)->Release(); - return true; -} - PStorageParent* ContentParent::AllocPStorageParent() { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 252e0235c90..5bfa77b18d1 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -321,9 +321,6 @@ private: virtual PSmsParent* AllocPSmsParent(); virtual bool DeallocPSmsParent(PSmsParent*); - virtual PTelephonyParent* AllocPTelephonyParent(); - virtual bool DeallocPTelephonyParent(PTelephonyParent*); - virtual PStorageParent* AllocPStorageParent(); virtual bool DeallocPStorageParent(PStorageParent* aActor); diff --git a/dom/mobilemessage/src/Makefile.in b/dom/mobilemessage/src/Makefile.in index e45e9b971de..4dfe608bd89 100644 --- a/dom/mobilemessage/src/Makefile.in +++ b/dom/mobilemessage/src/Makefile.in @@ -33,6 +33,7 @@ LOCAL_INCLUDES += $(VPATH:%=-I%) ifdef MOZ_B2G_RIL LOCAL_INCLUDES += \ + -I$(topsrcdir)/dom/telephony \ -I$(topsrcdir)/dom/system/gonk \ $(NULL) endif diff --git a/dom/moz.build b/dom/moz.build index 4c87f43ef34..5aeb1ba6a7a 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -72,8 +72,7 @@ PARALLEL_DIRS += [ 'camera', 'audiochannel', 'promise', - 'wappush', - 'telephony', + 'wappush' ] if CONFIG['OS_ARCH'] == 'WINNT': @@ -81,6 +80,7 @@ if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['MOZ_B2G_RIL']: PARALLEL_DIRS += [ + 'telephony', 'wifi', 'icc', 'cellbroadcast', diff --git a/dom/system/gonk/Makefile.in b/dom/system/gonk/Makefile.in index d19b0731f1f..d648d2d7407 100644 --- a/dom/system/gonk/Makefile.in +++ b/dom/system/gonk/Makefile.in @@ -26,6 +26,7 @@ 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 \ diff --git a/dom/telephony/CallEvent.cpp b/dom/telephony/CallEvent.cpp index 580750f0608..30ab81aee46 100644 --- a/dom/telephony/CallEvent.cpp +++ b/dom/telephony/CallEvent.cpp @@ -11,7 +11,6 @@ USING_TELEPHONY_NAMESPACE using namespace mozilla::dom; -using mozilla::ErrorResult; /* static */ already_AddRefed diff --git a/dom/telephony/Makefile.in b/dom/telephony/Makefile.in index cf24906409e..143590c476a 100644 --- a/dom/telephony/Makefile.in +++ b/dom/telephony/Makefile.in @@ -5,18 +5,11 @@ DEPTH = @DEPTH@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ -VPATH = \ - $(srcdir) \ - $(srcdir)/ipc \ - $(NULL) +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/dom/dom-config.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 + diff --git a/dom/telephony/Telephony.cpp b/dom/telephony/Telephony.cpp index 95749b0fb6f..430242e65c6 100644 --- a/dom/telephony/Telephony.cpp +++ b/dom/telephony/Telephony.cpp @@ -24,9 +24,10 @@ #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 { @@ -50,8 +51,6 @@ public: MOZ_ASSERT(mTelephony); } - virtual ~Listener() {} - void Disconnect() { @@ -112,7 +111,7 @@ Telephony::Shutdown() mListener->Disconnect(); if (mProvider) { - mProvider->UnregisterListener(mListener); + mProvider->UnregisterTelephonyMsg(mListener); mProvider = nullptr; } @@ -133,7 +132,7 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv) NS_ASSERTION(aOwner, "Null owner!"); nsCOMPtr ril = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); if (!ril) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; @@ -166,7 +165,7 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv) return nullptr; } - rv = ril->RegisterListener(telephony->mListener); + rv = ril->RegisterTelephonyMsg(telephony->mListener); if (NS_FAILED(rv)) { aRv.Throw(rv); return nullptr; @@ -223,7 +222,12 @@ Telephony::DialInternal(bool isEmergency, } } - nsresult rv = mProvider->Dial(aNumber, isEmergency); + nsresult rv; + if (isEmergency) { + rv = mProvider->DialEmergency(aNumber); + } else { + rv = mProvider->Dial(aNumber); + } if (NS_FAILED(rv)) { aRv.Throw(rv); return nullptr; @@ -587,7 +591,7 @@ NS_IMETHODIMP Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState, const nsAString& aNumber, bool aIsActive, bool aIsOutgoing, bool aIsEmergency, - bool aIsConference) + bool aIsConference, bool* aContinue) { nsRefPtr call; @@ -599,10 +603,12 @@ 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; } @@ -616,6 +622,7 @@ Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState, mCalls.Contains(call), "Should have auto-added new call!"); + *aContinue = true; return NS_OK; } diff --git a/dom/telephony/TelephonyCall.cpp b/dom/telephony/TelephonyCall.cpp index 23868f82964..f90389da17a 100644 --- a/dom/telephony/TelephonyCall.cpp +++ b/dom/telephony/TelephonyCall.cpp @@ -15,7 +15,6 @@ USING_TELEPHONY_NAMESPACE using namespace mozilla::dom; -using mozilla::ErrorResult; // static already_AddRefed diff --git a/dom/telephony/TelephonyCallGroup.cpp b/dom/telephony/TelephonyCallGroup.cpp index d5571a657ac..0e71643afba 100644 --- a/dom/telephony/TelephonyCallGroup.cpp +++ b/dom/telephony/TelephonyCallGroup.cpp @@ -13,7 +13,6 @@ USING_TELEPHONY_NAMESPACE using namespace mozilla::dom; -using mozilla::ErrorResult; TelephonyCallGroup::TelephonyCallGroup() : mCallState(nsITelephonyProvider::CALL_STATE_UNKNOWN) diff --git a/dom/telephony/TelephonyFactory.cpp b/dom/telephony/TelephonyFactory.cpp deleted file mode 100644 index cdb2b88dd86..00000000000 --- a/dom/telephony/TelephonyFactory.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- 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 -TelephonyFactory::CreateTelephonyProvider() -{ - nsCOMPtr provider; - - if (XRE_GetProcessType() == GeckoProcessType_Content) { - provider = new TelephonyIPCProvider(); - } - - return provider.forget(); -} diff --git a/dom/telephony/TelephonyFactory.h b/dom/telephony/TelephonyFactory.h deleted file mode 100644 index 07e3f779304..00000000000 --- a/dom/telephony/TelephonyFactory.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- 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 CreateTelephonyProvider(); -}; - -END_TELEPHONY_NAMESPACE - -#endif // mozilla_dom_telephony_TelephonyFactory_h diff --git a/dom/telephony/ipc/TelephonyChild.cpp b/dom/telephony/ipc/TelephonyChild.cpp deleted file mode 100644 index a4c85f241ca..00000000000 --- a/dom/telephony/ipc/TelephonyChild.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- 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" - -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; -} diff --git a/dom/telephony/ipc/TelephonyChild.h b/dom/telephony/ipc/TelephonyChild.h deleted file mode 100644 index 91eb1f8d2a5..00000000000 --- a/dom/telephony/ipc/TelephonyChild.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- 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" -#include "nsITelephonyProvider.h" - -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 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 mListener; -}; - -END_TELEPHONY_NAMESPACE - -#endif // mozilla_dom_telephony_TelephonyChild_h diff --git a/dom/telephony/ipc/TelephonyIPCProvider.cpp b/dom/telephony/ipc/TelephonyIPCProvider.cpp deleted file mode 100644 index 93843d5e956..00000000000 --- a/dom/telephony/ipc/TelephonyIPCProvider.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- 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; -} diff --git a/dom/telephony/ipc/TelephonyIPCProvider.h b/dom/telephony/ipc/TelephonyIPCProvider.h deleted file mode 100644 index 928fd1d6567..00000000000 --- a/dom/telephony/ipc/TelephonyIPCProvider.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- 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 > mListeners; - PTelephonyChild* mPTelephonyChild; -}; - -END_TELEPHONY_NAMESPACE - -#endif // mozilla_dom_telephony_TelephonyIPCProvider_h diff --git a/dom/telephony/ipc/TelephonyParent.cpp b/dom/telephony/ipc/TelephonyParent.cpp deleted file mode 100644 index 3e82f86836e..00000000000 --- a/dom/telephony/ipc/TelephonyParent.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* -*- 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(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(aActor)->Release(); - return true; -} - -bool -TelephonyParent::Recv__delete__() -{ - return true; // Unregister listener in TelephonyParent::ActorDestroy(). -} - -bool -TelephonyParent::RecvRegisterListener() -{ - NS_ENSURE_TRUE(!mRegistered, true); - - nsCOMPtr 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 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 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 provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->HangUp(aCallIndex); - return true; -} - -bool -TelephonyParent::RecvAnswerCall(const uint32_t& aCallIndex) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->AnswerCall(aCallIndex); - return true; -} - -bool -TelephonyParent::RecvRejectCall(const uint32_t& aCallIndex) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->RejectCall(aCallIndex); - return true; -} - -bool -TelephonyParent::RecvHoldCall(const uint32_t& aCallIndex) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->HoldCall(aCallIndex); - return true; -} - -bool -TelephonyParent::RecvResumeCall(const uint32_t& aCallIndex) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->ResumeCall(aCallIndex); - return true; -} - -bool -TelephonyParent::RecvConferenceCall() -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->ConferenceCall(); - return true; -} - -bool -TelephonyParent::RecvSeparateCall(const uint32_t& aCallState) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->SeparateCall(aCallState); - return true; -} - -bool -TelephonyParent::RecvHoldConference() -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->HoldConference(); - return true; -} - -bool -TelephonyParent::RecvResumeConference() -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->ResumeConference(); - return true; -} - -bool -TelephonyParent::RecvStartTone(const nsString& aTone) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->StartTone(aTone); - return true; -} - -bool -TelephonyParent::RecvStopTone() -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->StopTone(); - return true; -} - -bool -TelephonyParent::RecvGetMicrophoneMuted(bool* aMuted) -{ - *aMuted = false; - - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->GetMicrophoneMuted(aMuted); - return true; -} - -bool -TelephonyParent::RecvSetMicrophoneMuted(const bool& aMuted) -{ - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->SetMicrophoneMuted(aMuted); - return true; -} - -bool -TelephonyParent::RecvGetSpeakerEnabled(bool* aEnabled) -{ - *aEnabled = false; - - nsCOMPtr provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, true); - - provider->GetSpeakerEnabled(aEnabled); - return true; -} - -bool -TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled) -{ - nsCOMPtr 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 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!"); -} diff --git a/dom/telephony/ipc/TelephonyParent.h b/dom/telephony/ipc/TelephonyParent.h deleted file mode 100644 index ac508c264be..00000000000 --- a/dom/telephony/ipc/TelephonyParent.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- 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 */ diff --git a/dom/telephony/moz.build b/dom/telephony/moz.build index e15bf63810e..8910a24c887 100644 --- a/dom/telephony/moz.build +++ b/dom/telephony/moz.build @@ -12,34 +12,12 @@ 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 @@ -47,3 +25,4 @@ FAIL_ON_WARNINGS = True LIBXUL_LIBRARY = True LIBRARY_NAME = 'domtelephony_s' + diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index b5d7dafa936..f18ce2bddd4 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -34,8 +34,6 @@ webidl_files = \ BiquadFilterNode.webidl \ Blob.webidl \ BrowserElementDictionaries.webidl \ - CallEvent.webidl \ - CallsList.webidl \ CameraControl.webidl \ CameraManager.webidl \ CanvasRenderingContext2D.webidl \ @@ -361,9 +359,6 @@ webidl_files = \ SVGViewElement.webidl \ SVGZoomAndPan.webidl \ SVGZoomEvent.webidl \ - Telephony.webidl \ - TelephonyCall.webidl \ - TelephonyCallGroup.webidl \ Text.webidl \ TextDecoder.webidl \ TextEncoder.webidl \ @@ -450,8 +445,12 @@ endif ifdef MOZ_B2G_RIL webidl_files += \ + CallsList.webidl \ MozStkCommandEvent.webidl \ MozVoicemail.webidl \ + Telephony.webidl \ + TelephonyCall.webidl \ + TelephonyCallGroup.webidl \ $(NULL) endif @@ -496,6 +495,7 @@ endif ifdef MOZ_B2G_RIL webidl_files += \ + CallEvent.webidl \ CFStateChangeEvent.webidl \ DataErrorEvent.webidl \ IccCardLockErrorEvent.webidl \ diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index baf892dab18..0db2d8428cf 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -66,7 +66,6 @@ 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) \ @@ -137,6 +136,7 @@ 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) \ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 6278d4b8352..1d55dd37446 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -230,9 +230,6 @@ 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 @@ -241,7 +238,6 @@ 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; @@ -342,8 +338,6 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService, #endif NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService, MediaManager::GetInstance) -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyProvider, - TelephonyFactory::CreateTelephonyProvider) //----------------------------------------------------------------------------- @@ -817,7 +811,6 @@ 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, @@ -1100,7 +1093,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { #ifdef ACCESSIBILITY { &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, CreateA11yService }, #endif - { &kTELEPHONY_PROVIDER_CID, false, NULL, nsITelephonyProviderConstructor }, { NULL } }; @@ -1256,7 +1248,6 @@ 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 } };