dom/telephony/TelephonyCallGroup.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/telephony/TelephonyCommon.h"
    12 namespace mozilla {
    13 namespace dom {
    15 class TelephonyCallGroup MOZ_FINAL : public DOMEventTargetHelper
    16 {
    17   nsRefPtr<Telephony> mTelephony;
    19   nsTArray<nsRefPtr<TelephonyCall> > mCalls;
    21   nsRefPtr<CallsList> mCallsList;
    23   nsString mState;
    25   uint16_t mCallState;
    27 public:
    28   NS_DECL_ISUPPORTS_INHERITED
    29   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCallGroup,
    30                                            DOMEventTargetHelper)
    32   nsPIDOMWindow*
    33   GetParentObject() const
    34   {
    35     return GetOwner();
    36   }
    38   // WrapperCache
    39   virtual JSObject*
    40   WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    42   // WebIDL interface
    43   already_AddRefed<CallsList>
    44   Calls() const;
    46   void
    47   Add(TelephonyCall& aCall, ErrorResult& aRv);
    49   void
    50   Add(TelephonyCall& aCall, TelephonyCall& aSecondCall, ErrorResult& aRv);
    52   void
    53   Remove(TelephonyCall& aCall, ErrorResult& aRv);
    55   void
    56   Hold(ErrorResult& aRv);
    58   void
    59   Resume(ErrorResult& aRv);
    61   void
    62   GetState(nsString& aState) const
    63   {
    64     aState = mState;
    65   }
    67   IMPL_EVENT_HANDLER(statechange)
    68   IMPL_EVENT_HANDLER(connected)
    69   IMPL_EVENT_HANDLER(holding)
    70   IMPL_EVENT_HANDLER(held)
    71   IMPL_EVENT_HANDLER(resuming)
    72   IMPL_EVENT_HANDLER(callschanged)
    73   IMPL_EVENT_HANDLER(error)
    75   static already_AddRefed<TelephonyCallGroup>
    76   Create(Telephony* aTelephony);
    78   void
    79   AddCall(TelephonyCall* aCall);
    81   void
    82   RemoveCall(TelephonyCall* aCall);
    84   already_AddRefed<TelephonyCall>
    85   GetCall(uint32_t aServiceId, uint32_t aCallIndex);
    87   const nsTArray<nsRefPtr<TelephonyCall> >&
    88   CallsArray() const
    89   {
    90     return mCalls;
    91   }
    93   void
    94   ChangeState(uint16_t aCallState);
    96   uint16_t
    97   CallState() const
    98   {
    99     return mCallState;
   100   }
   102   nsresult
   103   NotifyError(const nsAString& aName, const nsAString& aMessage);
   105 private:
   106   TelephonyCallGroup(nsPIDOMWindow* aOwner);
   107   ~TelephonyCallGroup();
   109   nsresult
   110   NotifyCallsChanged(TelephonyCall* aCall);
   112   nsresult
   113   DispatchCallEvent(const nsAString& aType,
   114                     TelephonyCall* aCall);
   116   bool CanConference(const TelephonyCall& aCall, TelephonyCall* aSecondCall);
   117 };
   119 } // namespace dom
   120 } // namespace mozilla
   122 #endif // mozilla_dom_telephony_telephonycallgroup_h__

mercurial