2013-07-15 12:27:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "CallsList.h"
|
|
|
|
#include "mozilla/dom/CallsListBinding.h"
|
|
|
|
|
|
|
|
#include "Telephony.h"
|
|
|
|
#include "TelephonyCall.h"
|
2013-07-06 14:24:55 +04:00
|
|
|
#include "TelephonyCallGroup.h"
|
2013-07-15 12:27:19 +04:00
|
|
|
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
2014-04-29 12:57:00 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CallsList,
|
|
|
|
mTelephony,
|
|
|
|
mGroup)
|
2013-07-15 12:27:19 +04:00
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(CallsList)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(CallsList)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CallsList)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2013-07-06 14:24:55 +04:00
|
|
|
CallsList::CallsList(Telephony* aTelephony, TelephonyCallGroup* aGroup)
|
|
|
|
: mTelephony(aTelephony), mGroup(aGroup)
|
2013-07-15 12:27:19 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(mTelephony);
|
|
|
|
}
|
|
|
|
|
|
|
|
CallsList::~CallsList()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPIDOMWindow*
|
|
|
|
CallsList::GetParentObject() const
|
|
|
|
{
|
|
|
|
return mTelephony->GetOwner();
|
|
|
|
}
|
|
|
|
|
|
|
|
JSObject*
|
2014-04-09 02:27:18 +04:00
|
|
|
CallsList::WrapObject(JSContext* aCx)
|
2013-07-15 12:27:19 +04:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-09 02:27:17 +04:00
|
|
|
return CallsListBinding::Wrap(aCx, this);
|
2013-07-15 12:27:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<TelephonyCall>
|
|
|
|
CallsList::Item(uint32_t aIndex) const
|
|
|
|
{
|
2013-07-06 14:24:55 +04:00
|
|
|
nsRefPtr<TelephonyCall> call;
|
|
|
|
call = mGroup ? mGroup->CallsArray().SafeElementAt(aIndex) :
|
|
|
|
mTelephony->CallsArray().SafeElementAt(aIndex);
|
|
|
|
|
2013-07-15 12:27:19 +04:00
|
|
|
return call.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
CallsList::Length() const
|
|
|
|
{
|
2013-07-06 14:24:55 +04:00
|
|
|
return mGroup ? mGroup->CallsArray().Length() :
|
|
|
|
mTelephony->CallsArray().Length();
|
2013-07-15 12:27:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<TelephonyCall>
|
|
|
|
CallsList::IndexedGetter(uint32_t aIndex, bool& aFound) const
|
|
|
|
{
|
2013-07-06 14:24:55 +04:00
|
|
|
nsRefPtr<TelephonyCall> call;
|
|
|
|
call = mGroup ? mGroup->CallsArray().SafeElementAt(aIndex) :
|
|
|
|
mTelephony->CallsArray().SafeElementAt(aIndex);
|
2013-07-15 12:27:19 +04:00
|
|
|
aFound = call ? true : false;
|
2013-07-06 14:24:55 +04:00
|
|
|
|
2013-07-15 12:27:19 +04:00
|
|
|
return call.forget();
|
|
|
|
}
|