Bug 822210 - cdma call waiting - part2 - telephony DOM. r=bent
authorHsin-Yi Tsai <htsai@mozilla.com>
Tue, 30 Jul 2013 17:08:53 +0800
changeset 141878 a50e396cb60adad6b6b5bf1a52d21071d2271b9d
parent 141877 3af6bb32ac84aadd0403e91ee50c12ff5d7db425
child 141879 fef9f66d8ae911939c7ce54aafd24bd5201b5bd5
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbent
bugs822210
milestone26.0a1
Bug 822210 - cdma call waiting - part2 - telephony DOM. r=bent
dom/telephony/Telephony.cpp
dom/telephony/TelephonyCall.h
--- a/dom/telephony/Telephony.cpp
+++ b/dom/telephony/Telephony.cpp
@@ -547,16 +547,28 @@ Telephony::NotifyError(int32_t aCallInde
   }
 
   // Set the call state to 'disconnected' and remove it from the calls list.
   callToNotify->NotifyError(aError);
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+Telephony::NotifyCdmaCallWaiting(const nsAString& aNumber)
+{
+  MOZ_ASSERT(mActiveCall &&
+             mActiveCall->CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED);
+
+  nsRefPtr<TelephonyCall> callToNotify = mActiveCall;
+  callToNotify->UpdateSecondNumber(aNumber);
+  DispatchCallEvent(NS_LITERAL_STRING("callschanged"), callToNotify);
+  return NS_OK;
+}
+
 nsresult
 Telephony::DispatchCallEvent(const nsAString& aType,
                              TelephonyCall* aCall)
 {
   // The call may be null in following cases:
   //   1. callschanged when notifying enumeration being completed
   //   2. remoteheld/remoteresumed.
   MOZ_ASSERT(aCall ||
--- a/dom/telephony/TelephonyCall.h
+++ b/dom/telephony/TelephonyCall.h
@@ -15,16 +15,17 @@ class nsPIDOMWindow;
 
 BEGIN_TELEPHONY_NAMESPACE
 
 class TelephonyCall MOZ_FINAL : public nsDOMEventTargetHelper
 {
   nsRefPtr<Telephony> mTelephony;
 
   nsString mNumber;
+  nsString mSecondNumber;
   nsString mState;
   bool mEmergency;
   nsRefPtr<mozilla::dom::DOMError> mError;
 
   uint32_t mCallIndex;
   uint16_t mCallState;
   bool mLive;
   bool mOutgoing;
@@ -48,16 +49,22 @@ public:
   // WebIDL
   void
   GetNumber(nsString& aNumber) const
   {
     aNumber.Assign(mNumber);
   }
 
   void
+  GetSecondNumber(nsString& aSecondNumber) const
+  {
+    aSecondNumber.Assign(mSecondNumber);
+  }
+
+  void
   GetState(nsString& aState) const
   {
     aState.Assign(mState);
   }
 
   bool
   Emergency() const
   {
@@ -123,16 +130,22 @@ public:
   }
 
   void
   UpdateEmergency(bool aEmergency)
   {
     mEmergency = aEmergency;
   }
 
+  void
+  UpdateSecondNumber(const nsAString& aNumber)
+  {
+    mSecondNumber = aNumber;
+  }
+
   bool
   IsOutgoing() const
   {
     return mOutgoing;
   }
 
   void
   NotifyError(const nsAString& aError);