1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/telephony/TelephonyCallGroup.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,122 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_telephony_telephonycallgroup_h__ 1.11 +#define mozilla_dom_telephony_telephonycallgroup_h__ 1.12 + 1.13 +#include "mozilla/dom/telephony/TelephonyCommon.h" 1.14 + 1.15 +namespace mozilla { 1.16 +namespace dom { 1.17 + 1.18 +class TelephonyCallGroup MOZ_FINAL : public DOMEventTargetHelper 1.19 +{ 1.20 + nsRefPtr<Telephony> mTelephony; 1.21 + 1.22 + nsTArray<nsRefPtr<TelephonyCall> > mCalls; 1.23 + 1.24 + nsRefPtr<CallsList> mCallsList; 1.25 + 1.26 + nsString mState; 1.27 + 1.28 + uint16_t mCallState; 1.29 + 1.30 +public: 1.31 + NS_DECL_ISUPPORTS_INHERITED 1.32 + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCallGroup, 1.33 + DOMEventTargetHelper) 1.34 + 1.35 + nsPIDOMWindow* 1.36 + GetParentObject() const 1.37 + { 1.38 + return GetOwner(); 1.39 + } 1.40 + 1.41 + // WrapperCache 1.42 + virtual JSObject* 1.43 + WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.44 + 1.45 + // WebIDL interface 1.46 + already_AddRefed<CallsList> 1.47 + Calls() const; 1.48 + 1.49 + void 1.50 + Add(TelephonyCall& aCall, ErrorResult& aRv); 1.51 + 1.52 + void 1.53 + Add(TelephonyCall& aCall, TelephonyCall& aSecondCall, ErrorResult& aRv); 1.54 + 1.55 + void 1.56 + Remove(TelephonyCall& aCall, ErrorResult& aRv); 1.57 + 1.58 + void 1.59 + Hold(ErrorResult& aRv); 1.60 + 1.61 + void 1.62 + Resume(ErrorResult& aRv); 1.63 + 1.64 + void 1.65 + GetState(nsString& aState) const 1.66 + { 1.67 + aState = mState; 1.68 + } 1.69 + 1.70 + IMPL_EVENT_HANDLER(statechange) 1.71 + IMPL_EVENT_HANDLER(connected) 1.72 + IMPL_EVENT_HANDLER(holding) 1.73 + IMPL_EVENT_HANDLER(held) 1.74 + IMPL_EVENT_HANDLER(resuming) 1.75 + IMPL_EVENT_HANDLER(callschanged) 1.76 + IMPL_EVENT_HANDLER(error) 1.77 + 1.78 + static already_AddRefed<TelephonyCallGroup> 1.79 + Create(Telephony* aTelephony); 1.80 + 1.81 + void 1.82 + AddCall(TelephonyCall* aCall); 1.83 + 1.84 + void 1.85 + RemoveCall(TelephonyCall* aCall); 1.86 + 1.87 + already_AddRefed<TelephonyCall> 1.88 + GetCall(uint32_t aServiceId, uint32_t aCallIndex); 1.89 + 1.90 + const nsTArray<nsRefPtr<TelephonyCall> >& 1.91 + CallsArray() const 1.92 + { 1.93 + return mCalls; 1.94 + } 1.95 + 1.96 + void 1.97 + ChangeState(uint16_t aCallState); 1.98 + 1.99 + uint16_t 1.100 + CallState() const 1.101 + { 1.102 + return mCallState; 1.103 + } 1.104 + 1.105 + nsresult 1.106 + NotifyError(const nsAString& aName, const nsAString& aMessage); 1.107 + 1.108 +private: 1.109 + TelephonyCallGroup(nsPIDOMWindow* aOwner); 1.110 + ~TelephonyCallGroup(); 1.111 + 1.112 + nsresult 1.113 + NotifyCallsChanged(TelephonyCall* aCall); 1.114 + 1.115 + nsresult 1.116 + DispatchCallEvent(const nsAString& aType, 1.117 + TelephonyCall* aCall); 1.118 + 1.119 + bool CanConference(const TelephonyCall& aCall, TelephonyCall* aSecondCall); 1.120 +}; 1.121 + 1.122 +} // namespace dom 1.123 +} // namespace mozilla 1.124 + 1.125 +#endif // mozilla_dom_telephony_telephonycallgroup_h__