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 154785 a50e396cb60adad6b6b5bf1a52d21071d2271b9d
parent 154784 3af6bb32ac84aadd0403e91ee50c12ff5d7db425
child 154786 fef9f66d8ae911939c7ce54aafd24bd5201b5bd5
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs822210
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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);