From 61452b55ea60224ae74d0c6e2d148c94cbe24bfb Mon Sep 17 00:00:00 2001 From: "Szu-Yu Chen [:aknow]" Date: Wed, 30 Oct 2013 15:06:41 -0400 Subject: [PATCH] Bug 814625 - Part 3: DOM: Code reorder. r=khuey --- dom/telephony/Telephony.cpp | 96 ++++++++++++++++++------------------- dom/telephony/Telephony.h | 28 +++++------ 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/dom/telephony/Telephony.cpp b/dom/telephony/Telephony.cpp index 5d1a050e589c..759de5341616 100644 --- a/dom/telephony/Telephony.cpp +++ b/dom/telephony/Telephony.cpp @@ -175,32 +175,6 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv) return telephony.forget(); } -already_AddRefed -Telephony::CreateNewDialingCall(const nsAString& aNumber) -{ - nsRefPtr call = - TelephonyCall::Create(this, aNumber, - nsITelephonyProvider::CALL_STATE_DIALING); - NS_ASSERTION(call, "This should never fail!"); - - NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!"); - - return call.forget(); -} - -void -Telephony::NoteDialedCallFromOtherInstance(const nsAString& aNumber) -{ - // We don't need to hang on to this call object, it is held alive by mCalls. - nsRefPtr call = CreateNewDialingCall(aNumber); -} - -nsresult -Telephony::NotifyCallsChanged(TelephonyCall* aCall) -{ - return DispatchCallEvent(NS_LITERAL_STRING("callschanged"), aCall); -} - already_AddRefed Telephony::DialInternal(bool isEmergency, const nsAString& aNumber, @@ -243,6 +217,32 @@ Telephony::DialInternal(bool isEmergency, return call.forget(); } +already_AddRefed +Telephony::CreateNewDialingCall(const nsAString& aNumber) +{ + nsRefPtr call = + TelephonyCall::Create(this, aNumber, + nsITelephonyProvider::CALL_STATE_DIALING); + NS_ASSERTION(call, "This should never fail!"); + + NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!"); + + return call.forget(); +} + +void +Telephony::NoteDialedCallFromOtherInstance(const nsAString& aNumber) +{ + // We don't need to hang on to this call object, it is held alive by mCalls. + nsRefPtr call = CreateNewDialingCall(aNumber); +} + +nsresult +Telephony::NotifyCallsChanged(TelephonyCall* aCall) +{ + return DispatchCallEvent(NS_LITERAL_STRING("callschanged"), aCall); +} + void Telephony::UpdateActiveCall(TelephonyCall* aCall, bool aIsAdding) { @@ -344,6 +344,28 @@ Telephony::DialEmergency(const nsAString& aNumber, ErrorResult& aRv) return call.forget(); } +void +Telephony::StartTone(const nsAString& aDTMFChar, ErrorResult& aRv) +{ + if (aDTMFChar.IsEmpty()) { + NS_WARNING("Empty tone string will be ignored"); + return; + } + + if (aDTMFChar.Length() > 1) { + aRv.Throw(NS_ERROR_INVALID_ARG); + return; + } + + aRv = mProvider->StartTone(aDTMFChar); +} + +void +Telephony::StopTone(ErrorResult& aRv) +{ + aRv = mProvider->StopTone(); +} + bool Telephony::GetMuted(ErrorResult& aRv) const { @@ -400,28 +422,6 @@ Telephony::ConferenceGroup() const return group.forget(); } -void -Telephony::StartTone(const nsAString& aDTMFChar, ErrorResult& aRv) -{ - if (aDTMFChar.IsEmpty()) { - NS_WARNING("Empty tone string will be ignored"); - return; - } - - if (aDTMFChar.Length() > 1) { - aRv.Throw(NS_ERROR_INVALID_ARG); - return; - } - - aRv = mProvider->StartTone(aDTMFChar); -} - -void -Telephony::StopTone(ErrorResult& aRv) -{ - aRv = mProvider->StopTone(); -} - // EventTarget void diff --git a/dom/telephony/Telephony.h b/dom/telephony/Telephony.h index 9ca43da6eab3..28b1b8df4cad 100644 --- a/dom/telephony/Telephony.h +++ b/dom/telephony/Telephony.h @@ -71,6 +71,12 @@ public: already_AddRefed DialEmergency(const nsAString& aNumber, ErrorResult& aRv); + void + StartTone(const nsAString& aDTMF, ErrorResult& aRv); + + void + StopTone(ErrorResult& aRv); + bool GetMuted(ErrorResult& aRv) const; @@ -92,12 +98,6 @@ public: already_AddRefed ConferenceGroup() const; - void - StartTone(const nsAString& aDTMF, ErrorResult& aRv); - - void - StopTone(ErrorResult& aRv); - IMPL_EVENT_HANDLER(incoming) IMPL_EVENT_HANDLER(callschanged) IMPL_EVENT_HANDLER(remoteheld) @@ -142,6 +142,14 @@ private: Telephony(); ~Telephony(); + void + Shutdown(); + + already_AddRefed + DialInternal(bool isEmergency, + const nsAString& aNumber, + ErrorResult& aRv); + already_AddRefed CreateNewDialingCall(const nsAString& aNumber); @@ -151,11 +159,6 @@ private: nsresult NotifyCallsChanged(TelephonyCall* aCall); - already_AddRefed - DialInternal(bool isEmergency, - const nsAString& aNumber, - ErrorResult& aRv); - nsresult DispatchCallEvent(const nsAString& aType, TelephonyCall* aCall); @@ -171,9 +174,6 @@ private: bool MoveCall(uint32_t aCallIndex, bool aIsConference); - - void - Shutdown(); }; } // namespace dom