Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / telephony / TelephonyCallGroup.h
blob91e1eae8996f835cf0ada9d4efc34a43b22184b4
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"
13 namespace mozilla {
14 namespace dom {
16 class TelephonyCallGroup MOZ_FINAL : public DOMEventTargetHelper
18 nsRefPtr<Telephony> mTelephony;
20 nsTArray<nsRefPtr<TelephonyCall> > mCalls;
22 nsRefPtr<CallsList> mCallsList;
24 nsString mState;
26 uint16_t mCallState;
28 public:
29 NS_DECL_ISUPPORTS_INHERITED
30 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCallGroup,
31 DOMEventTargetHelper)
33 nsPIDOMWindow*
34 GetParentObject() const
36 return GetOwner();
39 // WrapperCache
40 virtual JSObject*
41 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
43 // WebIDL interface
44 already_AddRefed<CallsList>
45 Calls() const;
47 void
48 Add(TelephonyCall& aCall, ErrorResult& aRv);
50 void
51 Add(TelephonyCall& aCall, TelephonyCall& aSecondCall, ErrorResult& aRv);
53 void
54 Remove(TelephonyCall& aCall, ErrorResult& aRv);
56 already_AddRefed<Promise>
57 HangUp(ErrorResult& aRv);
59 void
60 Hold(ErrorResult& aRv);
62 void
63 Resume(ErrorResult& aRv);
65 void
66 GetState(nsString& aState) const
68 aState = mState;
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);
82 void
83 AddCall(TelephonyCall* aCall);
85 void
86 RemoveCall(TelephonyCall* aCall);
88 already_AddRefed<TelephonyCall>
89 GetCall(uint32_t aServiceId, uint32_t aCallIndex);
91 const nsTArray<nsRefPtr<TelephonyCall> >&
92 CallsArray() const
94 return mCalls;
97 void
98 ChangeState(uint16_t aCallState);
100 uint16_t
101 CallState() const
103 return mCallState;
106 nsresult
107 NotifyError(const nsAString& aName, const nsAString& aMessage);
109 private:
110 explicit TelephonyCallGroup(nsPIDOMWindow* aOwner);
111 ~TelephonyCallGroup();
113 nsresult
114 NotifyCallsChanged(TelephonyCall* aCall);
116 nsresult
117 DispatchCallEvent(const nsAString& aType,
118 TelephonyCall* aCall);
120 bool CanConference(const TelephonyCall& aCall, TelephonyCall* aSecondCall);
123 } // namespace dom
124 } // namespace mozilla
126 #endif // mozilla_dom_telephony_telephonycallgroup_h__