зеркало из https://github.com/mozilla/gecko-dev.git
Bug 981519 - number and name presentation - part 3 - DOM & IPC code. r=smaug
This commit is contained in:
Родитель
9405057330
Коммит
279886c354
|
@ -25,6 +25,7 @@
|
||||||
#include "CallsList.h"
|
#include "CallsList.h"
|
||||||
#include "TelephonyCall.h"
|
#include "TelephonyCall.h"
|
||||||
#include "TelephonyCallGroup.h"
|
#include "TelephonyCallGroup.h"
|
||||||
|
#include "TelephonyCallId.h"
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using mozilla::ErrorResult;
|
using mozilla::ErrorResult;
|
||||||
|
@ -282,6 +283,9 @@ Telephony::CreateNewDialingCall(uint32_t aServiceId, const nsAString& aNumber,
|
||||||
{
|
{
|
||||||
nsRefPtr<TelephonyCall> call =
|
nsRefPtr<TelephonyCall> call =
|
||||||
TelephonyCall::Create(this, aServiceId, aNumber,
|
TelephonyCall::Create(this, aServiceId, aNumber,
|
||||||
|
nsITelephonyService::CALL_PRESENTATION_ALLOWED,
|
||||||
|
EmptyString(),
|
||||||
|
nsITelephonyService::CALL_PRESENTATION_ALLOWED,
|
||||||
nsITelephonyService::CALL_STATE_DIALING, aCallIndex);
|
nsITelephonyService::CALL_STATE_DIALING, aCallIndex);
|
||||||
NS_ASSERTION(call, "This should never fail!");
|
NS_ASSERTION(call, "This should never fail!");
|
||||||
|
|
||||||
|
@ -486,8 +490,10 @@ Telephony::EventListenerAdded(nsIAtom* aType)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
|
Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
|
||||||
uint16_t aCallState, const nsAString& aNumber,
|
uint16_t aCallState, const nsAString& aNumber,
|
||||||
bool aIsOutgoing, bool aIsEmergency,
|
uint16_t aNumberPresentation, const nsAString& aName,
|
||||||
bool aIsConference, bool aIsSwitchable, bool aIsMergeable)
|
uint16_t aNamePresentation, bool aIsOutgoing,
|
||||||
|
bool aIsEmergency, bool aIsConference,
|
||||||
|
bool aIsSwitchable, bool aIsMergeable)
|
||||||
{
|
{
|
||||||
nsRefPtr<TelephonyCall> modifiedCall
|
nsRefPtr<TelephonyCall> modifiedCall
|
||||||
= GetCallFromEverywhere(aServiceId, aCallIndex);
|
= GetCallFromEverywhere(aServiceId, aCallIndex);
|
||||||
|
@ -536,9 +542,10 @@ Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
|
||||||
|
|
||||||
// Didn't find this call in mCalls or mGroup. Create a new call.
|
// Didn't find this call in mCalls or mGroup. Create a new call.
|
||||||
nsRefPtr<TelephonyCall> call =
|
nsRefPtr<TelephonyCall> call =
|
||||||
TelephonyCall::Create(this, aServiceId, aNumber, aCallState, aCallIndex,
|
TelephonyCall::Create(this, aServiceId, aNumber, aNumberPresentation,
|
||||||
aIsEmergency, aIsConference, aIsSwitchable,
|
aName, aNamePresentation, aCallState, aCallIndex,
|
||||||
aIsMergeable);
|
aIsEmergency, aIsConference, aIsSwitchable,
|
||||||
|
aIsMergeable);
|
||||||
NS_ASSERTION(call, "This should never fail!");
|
NS_ASSERTION(call, "This should never fail!");
|
||||||
|
|
||||||
NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
|
NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
|
||||||
|
@ -580,8 +587,10 @@ Telephony::EnumerateCallStateComplete()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
|
Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
|
||||||
uint16_t aCallState, const nsAString& aNumber,
|
uint16_t aCallState, const nsAString& aNumber,
|
||||||
bool aIsOutgoing, bool aIsEmergency,
|
uint16_t aNumberPresentation, const nsAString& aName,
|
||||||
bool aIsConference, bool aIsSwitchable, bool aIsMergeable)
|
uint16_t aNamePresentation, bool aIsOutgoing,
|
||||||
|
bool aIsEmergency, bool aIsConference,
|
||||||
|
bool aIsSwitchable, bool aIsMergeable)
|
||||||
{
|
{
|
||||||
nsRefPtr<TelephonyCall> call;
|
nsRefPtr<TelephonyCall> call;
|
||||||
|
|
||||||
|
@ -596,7 +605,8 @@ Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Didn't know anything about this call before now.
|
// Didn't know anything about this call before now.
|
||||||
call = TelephonyCall::Create(this, aServiceId, aNumber, aCallState,
|
call = TelephonyCall::Create(this, aServiceId, aNumber, aNumberPresentation,
|
||||||
|
aName, aNamePresentation, aCallState,
|
||||||
aCallIndex, aIsEmergency, aIsConference,
|
aCallIndex, aIsEmergency, aIsConference,
|
||||||
aIsSwitchable, aIsMergeable);
|
aIsSwitchable, aIsMergeable);
|
||||||
NS_ASSERTION(call, "This should never fail!");
|
NS_ASSERTION(call, "This should never fail!");
|
||||||
|
@ -660,14 +670,20 @@ Telephony::NotifyError(uint32_t aServiceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
Telephony::NotifyCdmaCallWaiting(uint32_t aServiceId, const nsAString& aNumber)
|
Telephony::NotifyCdmaCallWaiting(uint32_t aServiceId, const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mCalls.Length() == 1);
|
MOZ_ASSERT(mCalls.Length() == 1);
|
||||||
|
|
||||||
nsRefPtr<TelephonyCall> callToNotify = mCalls[0];
|
nsRefPtr<TelephonyCall> callToNotify = mCalls[0];
|
||||||
MOZ_ASSERT(callToNotify && callToNotify->ServiceId() == aServiceId);
|
MOZ_ASSERT(callToNotify && callToNotify->ServiceId() == aServiceId);
|
||||||
|
|
||||||
callToNotify->UpdateSecondNumber(aNumber);
|
nsRefPtr<TelephonyCallId> id =
|
||||||
|
new TelephonyCallId(GetOwner(), aNumber, aNumberPresentation, aName,
|
||||||
|
aNamePresentation);
|
||||||
|
callToNotify->UpdateSecondId(id);
|
||||||
DispatchCallEvent(NS_LITERAL_STRING("callschanged"), callToNotify);
|
DispatchCallEvent(NS_LITERAL_STRING("callschanged"), callToNotify);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,25 +19,29 @@ using mozilla::ErrorResult;
|
||||||
// static
|
// static
|
||||||
already_AddRefed<TelephonyCall>
|
already_AddRefed<TelephonyCall>
|
||||||
TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
|
TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
|
||||||
const nsAString& aNumber, uint16_t aCallState,
|
const nsAString& aNumber, uint16_t aNumberPresentation,
|
||||||
uint32_t aCallIndex, bool aEmergency, bool aIsConference,
|
const nsAString& aName, uint16_t aNamePresentation,
|
||||||
bool aSwitchable, bool aMergeable)
|
uint16_t aCallState, uint32_t aCallIndex, bool aEmergency,
|
||||||
|
bool aIsConference, bool aSwitchable, bool aMergeable)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aTelephony, "Null pointer!");
|
NS_ASSERTION(aTelephony, "Null pointer!");
|
||||||
NS_ASSERTION(!aNumber.IsEmpty(), "Empty number!");
|
NS_ASSERTION(!aNumber.IsEmpty(), "Empty number!");
|
||||||
NS_ASSERTION(aCallIndex >= 1, "Invalid call index!");
|
NS_ASSERTION(aCallIndex >= 1, "Invalid call index!");
|
||||||
|
|
||||||
nsRefPtr<TelephonyCall> call = new TelephonyCall(aTelephony->GetOwner());
|
nsRefPtr<TelephonyCall> call = new TelephonyCall(aTelephony->GetOwner());
|
||||||
|
nsRefPtr<TelephonyCallId> id = new TelephonyCallId(aTelephony->GetOwner(),
|
||||||
|
aNumber, aNumberPresentation,
|
||||||
|
aName, aNamePresentation);
|
||||||
|
|
||||||
call->mTelephony = aTelephony;
|
call->mTelephony = aTelephony;
|
||||||
call->mServiceId = aServiceId;
|
call->mServiceId = aServiceId;
|
||||||
call->mNumber = aNumber;
|
|
||||||
call->mCallIndex = aCallIndex;
|
call->mCallIndex = aCallIndex;
|
||||||
call->mError = nullptr;
|
call->mError = nullptr;
|
||||||
call->mEmergency = aEmergency;
|
call->mEmergency = aEmergency;
|
||||||
call->mGroup = aIsConference ? aTelephony->ConferenceGroup() : nullptr;
|
call->mGroup = aIsConference ? aTelephony->ConferenceGroup() : nullptr;
|
||||||
call->mSwitchable = aSwitchable;
|
call->mSwitchable = aSwitchable;
|
||||||
call->mMergeable = aMergeable;
|
call->mMergeable = aMergeable;
|
||||||
|
call->mId = id;
|
||||||
|
|
||||||
call->ChangeStateInternal(aCallState, false);
|
call->ChangeStateInternal(aCallState, false);
|
||||||
|
|
||||||
|
@ -187,7 +191,9 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(TelephonyCall,
|
||||||
DOMEventTargetHelper,
|
DOMEventTargetHelper,
|
||||||
mTelephony,
|
mTelephony,
|
||||||
mError,
|
mError,
|
||||||
mGroup);
|
mGroup,
|
||||||
|
mId,
|
||||||
|
mSecondId);
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TelephonyCall)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TelephonyCall)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
||||||
|
@ -197,6 +203,20 @@ NS_IMPL_RELEASE_INHERITED(TelephonyCall, DOMEventTargetHelper)
|
||||||
|
|
||||||
// TelephonyCall WebIDL
|
// TelephonyCall WebIDL
|
||||||
|
|
||||||
|
already_AddRefed<TelephonyCallId>
|
||||||
|
TelephonyCall::Id() const
|
||||||
|
{
|
||||||
|
nsRefPtr<TelephonyCallId> id = mId;
|
||||||
|
return id.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<TelephonyCallId>
|
||||||
|
TelephonyCall::GetSecondId() const
|
||||||
|
{
|
||||||
|
nsRefPtr<TelephonyCallId> id = mSecondId;
|
||||||
|
return id.forget();
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMError>
|
already_AddRefed<DOMError>
|
||||||
TelephonyCall::GetError() const
|
TelephonyCall::GetError() const
|
||||||
{
|
{
|
||||||
|
@ -272,7 +292,7 @@ TelephonyCall::Hold(ErrorResult& aRv)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mSecondNumber.IsEmpty()) {
|
if (mSecondId) {
|
||||||
// No state transition when we switch two numbers within one TelephonyCall
|
// No state transition when we switch two numbers within one TelephonyCall
|
||||||
// object. Otherwise, the state here will be inconsistent with the backend
|
// object. Otherwise, the state here will be inconsistent with the backend
|
||||||
// RIL and will never be right.
|
// RIL and will never be right.
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "mozilla/dom/DOMError.h"
|
#include "mozilla/dom/DOMError.h"
|
||||||
|
|
||||||
|
#include "TelephonyCallId.h"
|
||||||
|
|
||||||
class nsPIDOMWindow;
|
class nsPIDOMWindow;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
@ -21,9 +23,10 @@ class TelephonyCall MOZ_FINAL : public DOMEventTargetHelper
|
||||||
nsRefPtr<Telephony> mTelephony;
|
nsRefPtr<Telephony> mTelephony;
|
||||||
nsRefPtr<TelephonyCallGroup> mGroup;
|
nsRefPtr<TelephonyCallGroup> mGroup;
|
||||||
|
|
||||||
|
nsRefPtr<TelephonyCallId> mId;
|
||||||
|
nsRefPtr<TelephonyCallId> mSecondId;
|
||||||
|
|
||||||
uint32_t mServiceId;
|
uint32_t mServiceId;
|
||||||
nsString mNumber;
|
|
||||||
nsString mSecondNumber;
|
|
||||||
nsString mState;
|
nsString mState;
|
||||||
bool mEmergency;
|
bool mEmergency;
|
||||||
nsRefPtr<DOMError> mError;
|
nsRefPtr<DOMError> mError;
|
||||||
|
@ -39,7 +42,6 @@ public:
|
||||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCall,
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCall,
|
||||||
DOMEventTargetHelper)
|
DOMEventTargetHelper)
|
||||||
|
|
||||||
friend class Telephony;
|
friend class Telephony;
|
||||||
|
|
||||||
nsPIDOMWindow*
|
nsPIDOMWindow*
|
||||||
|
@ -53,17 +55,11 @@ public:
|
||||||
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||||
|
|
||||||
// WebIDL
|
// WebIDL
|
||||||
void
|
already_AddRefed<TelephonyCallId>
|
||||||
GetNumber(nsString& aNumber) const
|
Id() const;
|
||||||
{
|
|
||||||
aNumber.Assign(mNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
already_AddRefed<TelephonyCallId>
|
||||||
GetSecondNumber(nsString& aSecondNumber) const
|
GetSecondId() const;
|
||||||
{
|
|
||||||
aSecondNumber.Assign(mSecondNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GetState(nsString& aState) const
|
GetState(nsString& aState) const
|
||||||
|
@ -122,7 +118,9 @@ public:
|
||||||
|
|
||||||
static already_AddRefed<TelephonyCall>
|
static already_AddRefed<TelephonyCall>
|
||||||
Create(Telephony* aTelephony, uint32_t aServiceId,
|
Create(Telephony* aTelephony, uint32_t aServiceId,
|
||||||
const nsAString& aNumber, uint16_t aCallState, uint32_t aCallIndex,
|
const nsAString& aNumber, uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName, uint16_t aNamePresentation,
|
||||||
|
uint16_t aCallState, uint32_t aCallIndex,
|
||||||
bool aEmergency = false, bool aIsConference = false,
|
bool aEmergency = false, bool aIsConference = false,
|
||||||
bool aSwitchable = true, bool aMergeable = true);
|
bool aSwitchable = true, bool aMergeable = true);
|
||||||
|
|
||||||
|
@ -156,12 +154,6 @@ public:
|
||||||
mEmergency = aEmergency;
|
mEmergency = aEmergency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
UpdateSecondNumber(const nsAString& aNumber)
|
|
||||||
{
|
|
||||||
mSecondNumber = aNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
UpdateSwitchable(bool aSwitchable) {
|
UpdateSwitchable(bool aSwitchable) {
|
||||||
mSwitchable = aSwitchable;
|
mSwitchable = aSwitchable;
|
||||||
|
@ -172,6 +164,11 @@ public:
|
||||||
mMergeable = aMergeable;
|
mMergeable = aMergeable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UpdateSecondId(TelephonyCallId* aId) {
|
||||||
|
mSecondId = aId;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NotifyError(const nsAString& aError);
|
NotifyError(const nsAString& aError);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||||
|
/* 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 "TelephonyCallId.h"
|
||||||
|
|
||||||
|
#include "nsITelephonyService.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
TelephonyCallId::TelephonyCallId(nsPIDOMWindow* aWindow,
|
||||||
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation)
|
||||||
|
: mWindow(aWindow), mNumber(aNumber), mNumberPresentation(aNumberPresentation),
|
||||||
|
mName(aName), mNamePresentation(aNamePresentation)
|
||||||
|
{
|
||||||
|
SetIsDOMBinding();
|
||||||
|
}
|
||||||
|
|
||||||
|
TelephonyCallId::~TelephonyCallId()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
TelephonyCallId::WrapObject(JSContext* aCx)
|
||||||
|
{
|
||||||
|
return TelephonyCallIdBinding::Wrap(aCx, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CallIdPresentation
|
||||||
|
TelephonyCallId::GetPresentationStr(uint16_t aPresentation) const
|
||||||
|
{
|
||||||
|
switch (aPresentation) {
|
||||||
|
case nsITelephonyService::CALL_PRESENTATION_ALLOWED:
|
||||||
|
return CallIdPresentation::Allowed;
|
||||||
|
case nsITelephonyService::CALL_PRESENTATION_RESTRICTED:
|
||||||
|
return CallIdPresentation::Restricted;
|
||||||
|
case nsITelephonyService::CALL_PRESENTATION_UNKNOWN:
|
||||||
|
return CallIdPresentation::Unknown;
|
||||||
|
case nsITelephonyService::CALL_PRESENTATION_PAYPHONE:
|
||||||
|
return CallIdPresentation::Payphone;
|
||||||
|
default:
|
||||||
|
MOZ_ASSUME_UNREACHABLE("Bad presentation!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TelephonyCallId, mWindow)
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(TelephonyCallId)
|
||||||
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(TelephonyCallId)
|
||||||
|
|
||||||
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TelephonyCallId)
|
||||||
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
// WebIDL
|
||||||
|
|
||||||
|
CallIdPresentation
|
||||||
|
TelephonyCallId::NumberPresentation() const
|
||||||
|
{
|
||||||
|
return GetPresentationStr(mNumberPresentation);
|
||||||
|
}
|
||||||
|
|
||||||
|
CallIdPresentation
|
||||||
|
TelephonyCallId::NamePresentation() const
|
||||||
|
{
|
||||||
|
return GetPresentationStr(mNamePresentation);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_TelephonyCallId_h
|
||||||
|
#define mozilla_dom_TelephonyCallId_h
|
||||||
|
|
||||||
|
#include "mozilla/dom/TelephonyCallIdBinding.h"
|
||||||
|
#include "mozilla/dom/telephony/TelephonyCommon.h"
|
||||||
|
|
||||||
|
#include "nsWrapperCache.h"
|
||||||
|
|
||||||
|
class nsPIDOMWindow;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class TelephonyCallId MOZ_FINAL : public nsISupports,
|
||||||
|
public nsWrapperCache
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TelephonyCallId)
|
||||||
|
|
||||||
|
TelephonyCallId(nsPIDOMWindow* aWindow, const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation, const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation);
|
||||||
|
|
||||||
|
nsPIDOMWindow*
|
||||||
|
GetParentObject() const
|
||||||
|
{
|
||||||
|
return mWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual JSObject*
|
||||||
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
// WebIDL
|
||||||
|
|
||||||
|
void
|
||||||
|
GetNumber(nsString& aNumber) const
|
||||||
|
{
|
||||||
|
aNumber.Assign(mNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
CallIdPresentation
|
||||||
|
NumberPresentation() const;
|
||||||
|
|
||||||
|
void
|
||||||
|
GetName(nsString& aName) const
|
||||||
|
{
|
||||||
|
aName.Assign(mName);
|
||||||
|
}
|
||||||
|
|
||||||
|
CallIdPresentation
|
||||||
|
NamePresentation() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
~TelephonyCallId();
|
||||||
|
|
||||||
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||||
|
nsString mNumber;
|
||||||
|
uint16_t mNumberPresentation;
|
||||||
|
nsString mName;
|
||||||
|
uint16_t mNamePresentation;
|
||||||
|
|
||||||
|
CallIdPresentation
|
||||||
|
GetPresentationStr(uint16_t aPresentation) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // mozilla_dom_TelephonyCallId_h
|
|
@ -39,7 +39,7 @@ child:
|
||||||
|
|
||||||
NotifyCallStateChanged(uint32_t aClientId, IPCCallStateData aData);
|
NotifyCallStateChanged(uint32_t aClientId, IPCCallStateData aData);
|
||||||
|
|
||||||
NotifyCdmaCallWaiting(uint32_t aClientId, nsString aNumber);
|
NotifyCdmaCallWaiting(uint32_t aClientId, IPCCdmaWaitingCallData aData);
|
||||||
|
|
||||||
NotifyConferenceCallStateChanged(uint16_t aCallState);
|
NotifyConferenceCallStateChanged(uint16_t aCallState);
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,9 @@ TelephonyChild::RecvNotifyCallStateChanged(const uint32_t& aClientId,
|
||||||
aData.callIndex(),
|
aData.callIndex(),
|
||||||
aData.callState(),
|
aData.callState(),
|
||||||
aData.number(),
|
aData.number(),
|
||||||
|
aData.numberPresentation(),
|
||||||
|
aData.name(),
|
||||||
|
aData.namePresentation(),
|
||||||
aData.isOutGoing(),
|
aData.isOutGoing(),
|
||||||
aData.isEmergency(),
|
aData.isEmergency(),
|
||||||
aData.isConference(),
|
aData.isConference(),
|
||||||
|
@ -75,11 +78,15 @@ TelephonyChild::RecvNotifyCallStateChanged(const uint32_t& aClientId,
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TelephonyChild::RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,
|
TelephonyChild::RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,
|
||||||
const nsString& aNumber)
|
const IPCCdmaWaitingCallData& aData)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mService);
|
MOZ_ASSERT(mService);
|
||||||
|
|
||||||
mService->NotifyCdmaCallWaiting(aClientId, aNumber);
|
mService->NotifyCdmaCallWaiting(aClientId,
|
||||||
|
aData.number(),
|
||||||
|
aData.numberPresentation(),
|
||||||
|
aData.name(),
|
||||||
|
aData.namePresentation());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +165,9 @@ TelephonyRequestChild::RecvNotifyEnumerateCallState(const uint32_t& aClientId,
|
||||||
aData.callIndex(),
|
aData.callIndex(),
|
||||||
aData.callState(),
|
aData.callState(),
|
||||||
aData.number(),
|
aData.number(),
|
||||||
|
aData.numberPresentation(),
|
||||||
|
aData.name(),
|
||||||
|
aData.namePresentation(),
|
||||||
aData.isOutGoing(),
|
aData.isOutGoing(),
|
||||||
aData.isEmergency(),
|
aData.isEmergency(),
|
||||||
aData.isConference(),
|
aData.isConference(),
|
||||||
|
|
|
@ -42,7 +42,7 @@ protected:
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,
|
RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,
|
||||||
const nsString& aNumber) MOZ_OVERRIDE;
|
const IPCCdmaWaitingCallData& aData) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState) MOZ_OVERRIDE;
|
RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState) MOZ_OVERRIDE;
|
||||||
|
|
|
@ -355,6 +355,9 @@ TelephonyIPCService::CallStateChanged(uint32_t aClientId,
|
||||||
uint32_t aCallIndex,
|
uint32_t aCallIndex,
|
||||||
uint16_t aCallState,
|
uint16_t aCallState,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation,
|
||||||
bool aIsOutgoing,
|
bool aIsOutgoing,
|
||||||
bool aIsEmergency,
|
bool aIsEmergency,
|
||||||
bool aIsConference,
|
bool aIsConference,
|
||||||
|
@ -363,6 +366,7 @@ TelephonyIPCService::CallStateChanged(uint32_t aClientId,
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < mListeners.Length(); i++) {
|
for (uint32_t i = 0; i < mListeners.Length(); i++) {
|
||||||
mListeners[i]->CallStateChanged(aClientId, aCallIndex, aCallState, aNumber,
|
mListeners[i]->CallStateChanged(aClientId, aCallIndex, aCallState, aNumber,
|
||||||
|
aNumberPresentation, aName, aNamePresentation,
|
||||||
aIsOutgoing, aIsEmergency, aIsConference,
|
aIsOutgoing, aIsEmergency, aIsConference,
|
||||||
aIsSwitchable, aIsMergeable);
|
aIsSwitchable, aIsMergeable);
|
||||||
}
|
}
|
||||||
|
@ -389,6 +393,9 @@ TelephonyIPCService::EnumerateCallState(uint32_t aClientId,
|
||||||
uint32_t aCallIndex,
|
uint32_t aCallIndex,
|
||||||
uint16_t aCallState,
|
uint16_t aCallState,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation,
|
||||||
bool aIsOutgoing,
|
bool aIsOutgoing,
|
||||||
bool aIsEmergency,
|
bool aIsEmergency,
|
||||||
bool aIsConference,
|
bool aIsConference,
|
||||||
|
@ -400,10 +407,14 @@ TelephonyIPCService::EnumerateCallState(uint32_t aClientId,
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
TelephonyIPCService::NotifyCdmaCallWaiting(uint32_t aClientId,
|
TelephonyIPCService::NotifyCdmaCallWaiting(uint32_t aClientId,
|
||||||
const nsAString& aNumber)
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < mListeners.Length(); i++) {
|
for (uint32_t i = 0; i < mListeners.Length(); i++) {
|
||||||
mListeners[i]->NotifyCdmaCallWaiting(aClientId, aNumber);
|
mListeners[i]->NotifyCdmaCallWaiting(aClientId, aNumber, aNumberPresentation,
|
||||||
|
aName, aNamePresentation);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,6 +283,9 @@ TelephonyParent::CallStateChanged(uint32_t aClientId,
|
||||||
uint32_t aCallIndex,
|
uint32_t aCallIndex,
|
||||||
uint16_t aCallState,
|
uint16_t aCallState,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation,
|
||||||
bool aIsOutgoing,
|
bool aIsOutgoing,
|
||||||
bool aIsEmergency,
|
bool aIsEmergency,
|
||||||
bool aIsConference,
|
bool aIsConference,
|
||||||
|
@ -292,6 +295,7 @@ TelephonyParent::CallStateChanged(uint32_t aClientId,
|
||||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
|
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
|
||||||
|
aNumberPresentation, nsString(aName), aNamePresentation,
|
||||||
aIsOutgoing, aIsEmergency, aIsConference,
|
aIsOutgoing, aIsEmergency, aIsConference,
|
||||||
aIsSwitchable, aIsMergeable);
|
aIsSwitchable, aIsMergeable);
|
||||||
return SendNotifyCallStateChanged(aClientId, data) ? NS_OK : NS_ERROR_FAILURE;
|
return SendNotifyCallStateChanged(aClientId, data) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
|
@ -317,6 +321,9 @@ TelephonyParent::EnumerateCallState(uint32_t aClientId,
|
||||||
uint32_t aCallIndex,
|
uint32_t aCallIndex,
|
||||||
uint16_t aCallState,
|
uint16_t aCallState,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation,
|
||||||
bool aIsOutgoing,
|
bool aIsOutgoing,
|
||||||
bool aIsEmergency,
|
bool aIsEmergency,
|
||||||
bool aIsConference,
|
bool aIsConference,
|
||||||
|
@ -328,12 +335,16 @@ TelephonyParent::EnumerateCallState(uint32_t aClientId,
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
TelephonyParent::NotifyCdmaCallWaiting(uint32_t aClientId,
|
TelephonyParent::NotifyCdmaCallWaiting(uint32_t aClientId,
|
||||||
const nsAString& aNumber)
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
return SendNotifyCdmaCallWaiting(aClientId, nsString(aNumber))
|
IPCCdmaWaitingCallData data(nsString(aNumber), aNumberPresentation,
|
||||||
? NS_OK : NS_ERROR_FAILURE;
|
nsString(aName), aNamePresentation);
|
||||||
|
return SendNotifyCdmaCallWaiting(aClientId, data) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -430,6 +441,9 @@ TelephonyRequestParent::CallStateChanged(uint32_t aClientId,
|
||||||
uint32_t aCallIndex,
|
uint32_t aCallIndex,
|
||||||
uint16_t aCallState,
|
uint16_t aCallState,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation,
|
||||||
bool aIsOutgoing,
|
bool aIsOutgoing,
|
||||||
bool aIsEmergency,
|
bool aIsEmergency,
|
||||||
bool aIsConference,
|
bool aIsConference,
|
||||||
|
@ -458,6 +472,9 @@ TelephonyRequestParent::EnumerateCallState(uint32_t aClientId,
|
||||||
uint32_t aCallIndex,
|
uint32_t aCallIndex,
|
||||||
uint16_t aCallState,
|
uint16_t aCallState,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation,
|
||||||
bool aIsOutgoing,
|
bool aIsOutgoing,
|
||||||
bool aIsEmergency,
|
bool aIsEmergency,
|
||||||
bool aIsConference,
|
bool aIsConference,
|
||||||
|
@ -467,6 +484,7 @@ TelephonyRequestParent::EnumerateCallState(uint32_t aClientId,
|
||||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
|
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
|
||||||
|
aNumberPresentation, nsString(aName), aNamePresentation,
|
||||||
aIsOutgoing, aIsEmergency, aIsConference,
|
aIsOutgoing, aIsEmergency, aIsConference,
|
||||||
aIsSwitchable, aIsMergeable);
|
aIsSwitchable, aIsMergeable);
|
||||||
return SendNotifyEnumerateCallState(aClientId, data) ? NS_OK
|
return SendNotifyEnumerateCallState(aClientId, data) ? NS_OK
|
||||||
|
@ -475,7 +493,10 @@ TelephonyRequestParent::EnumerateCallState(uint32_t aClientId,
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
TelephonyRequestParent::NotifyCdmaCallWaiting(uint32_t aClientId,
|
TelephonyRequestParent::NotifyCdmaCallWaiting(uint32_t aClientId,
|
||||||
const nsAString& aNumber)
|
const nsAString& aNumber,
|
||||||
|
uint16_t aNumberPresentation,
|
||||||
|
const nsAString& aName,
|
||||||
|
uint16_t aNamePresentation)
|
||||||
{
|
{
|
||||||
MOZ_CRASH("Not a TelephonyParent!");
|
MOZ_CRASH("Not a TelephonyParent!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ struct IPCCallStateData
|
||||||
uint32_t callIndex;
|
uint32_t callIndex;
|
||||||
uint16_t callState;
|
uint16_t callState;
|
||||||
nsString number;
|
nsString number;
|
||||||
|
uint16_t numberPresentation;
|
||||||
|
nsString name;
|
||||||
|
uint16_t namePresentation;
|
||||||
bool isOutGoing;
|
bool isOutGoing;
|
||||||
bool isEmergency;
|
bool isEmergency;
|
||||||
bool isConference;
|
bool isConference;
|
||||||
|
@ -20,6 +23,14 @@ struct IPCCallStateData
|
||||||
bool isMergeable;
|
bool isMergeable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct IPCCdmaWaitingCallData
|
||||||
|
{
|
||||||
|
nsString number;
|
||||||
|
uint16_t numberPresentation;
|
||||||
|
nsString name;
|
||||||
|
uint16_t namePresentation;
|
||||||
|
};
|
||||||
|
|
||||||
} /* namespace telephony */
|
} /* namespace telephony */
|
||||||
} /* namespace dom */
|
} /* namespace dom */
|
||||||
} /* namespace mozilla */
|
} /* namespace mozilla */
|
||||||
|
|
|
@ -15,6 +15,7 @@ EXPORTS.mozilla.dom += [
|
||||||
'Telephony.h',
|
'Telephony.h',
|
||||||
'TelephonyCall.h',
|
'TelephonyCall.h',
|
||||||
'TelephonyCallGroup.h',
|
'TelephonyCallGroup.h',
|
||||||
|
'TelephonyCallId.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
EXPORTS.mozilla.dom.telephony += [
|
EXPORTS.mozilla.dom.telephony += [
|
||||||
|
@ -32,6 +33,7 @@ UNIFIED_SOURCES += [
|
||||||
'Telephony.cpp',
|
'Telephony.cpp',
|
||||||
'TelephonyCall.cpp',
|
'TelephonyCall.cpp',
|
||||||
'TelephonyCallGroup.cpp',
|
'TelephonyCallGroup.cpp',
|
||||||
|
'TelephonyCallId.cpp',
|
||||||
'TelephonyFactory.cpp',
|
'TelephonyFactory.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1110,6 +1110,8 @@ var interfaceNamesInGlobalScope =
|
||||||
{name: "TelephonyCall", b2g: true, pref: "dom.telephony.enabled"},
|
{name: "TelephonyCall", b2g: true, pref: "dom.telephony.enabled"},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{name: "TelephonyCallGroup", b2g: true, pref: "dom.telephony.enabled"},
|
{name: "TelephonyCallGroup", b2g: true, pref: "dom.telephony.enabled"},
|
||||||
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
{name: "TelephonyCallId", b2g: true, pref: "dom.telephony.enabled"},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
"Text",
|
"Text",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
|
Загрузка…
Ссылка в новой задаче