1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_telephony_telephonycallgroup_h__
8 #define mozilla_dom_telephony_telephonycallgroup_h__
10 #include "mozilla/dom/Promise.h"
11 #include "mozilla/dom/telephony/TelephonyCommon.h"
16 class TelephonyCallGroup MOZ_FINAL
: public DOMEventTargetHelper
18 nsRefPtr
<Telephony
> mTelephony
;
20 nsTArray
<nsRefPtr
<TelephonyCall
> > mCalls
;
22 nsRefPtr
<CallsList
> mCallsList
;
29 NS_DECL_ISUPPORTS_INHERITED
30 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCallGroup
,
34 GetParentObject() const
41 WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
44 already_AddRefed
<CallsList
>
48 Add(TelephonyCall
& aCall
, ErrorResult
& aRv
);
51 Add(TelephonyCall
& aCall
, TelephonyCall
& aSecondCall
, ErrorResult
& aRv
);
54 Remove(TelephonyCall
& aCall
, ErrorResult
& aRv
);
56 already_AddRefed
<Promise
>
57 HangUp(ErrorResult
& aRv
);
60 Hold(ErrorResult
& aRv
);
63 Resume(ErrorResult
& aRv
);
66 GetState(nsString
& aState
) const
71 IMPL_EVENT_HANDLER(statechange
)
72 IMPL_EVENT_HANDLER(connected
)
73 IMPL_EVENT_HANDLER(holding
)
74 IMPL_EVENT_HANDLER(held
)
75 IMPL_EVENT_HANDLER(resuming
)
76 IMPL_EVENT_HANDLER(callschanged
)
77 IMPL_EVENT_HANDLER(error
)
79 static already_AddRefed
<TelephonyCallGroup
>
80 Create(Telephony
* aTelephony
);
83 AddCall(TelephonyCall
* aCall
);
86 RemoveCall(TelephonyCall
* aCall
);
88 already_AddRefed
<TelephonyCall
>
89 GetCall(uint32_t aServiceId
, uint32_t aCallIndex
);
91 const nsTArray
<nsRefPtr
<TelephonyCall
> >&
98 ChangeState(uint16_t aCallState
);
107 NotifyError(const nsAString
& aName
, const nsAString
& aMessage
);
110 explicit TelephonyCallGroup(nsPIDOMWindow
* aOwner
);
111 ~TelephonyCallGroup();
114 NotifyCallsChanged(TelephonyCall
* aCall
);
117 DispatchCallEvent(const nsAString
& aType
,
118 TelephonyCall
* aCall
);
120 bool CanConference(const TelephonyCall
& aCall
, TelephonyCall
* aSecondCall
);
124 } // namespace mozilla
126 #endif // mozilla_dom_telephony_telephonycallgroup_h__