зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1131047 - Part 2: Obsolete some events (DOM). r=aknow
This commit is contained in:
Родитель
2445e6232d
Коммит
b170b7869a
|
@ -87,7 +87,11 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
|
||||||
{
|
{
|
||||||
nsRefPtr<TelephonyCall> kungFuDeathGrip(this);
|
nsRefPtr<TelephonyCall> kungFuDeathGrip(this);
|
||||||
|
|
||||||
nsString stateString;
|
// Update the internal state.
|
||||||
|
mCallState = aCallState;
|
||||||
|
|
||||||
|
// Indicate whether the external state have been changed.
|
||||||
|
bool externalStateChanged = true;
|
||||||
switch (aCallState) {
|
switch (aCallState) {
|
||||||
// These states are used internally to mark this call is currently being
|
// These states are used internally to mark this call is currently being
|
||||||
// controlled, and we should block consecutive requests of the same type
|
// controlled, and we should block consecutive requests of the same type
|
||||||
|
@ -96,36 +100,32 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
|
||||||
case nsITelephonyService::CALL_STATE_DISCONNECTING:
|
case nsITelephonyService::CALL_STATE_DISCONNECTING:
|
||||||
case nsITelephonyService::CALL_STATE_HOLDING:
|
case nsITelephonyService::CALL_STATE_HOLDING:
|
||||||
case nsITelephonyService::CALL_STATE_RESUMING:
|
case nsITelephonyService::CALL_STATE_RESUMING:
|
||||||
|
externalStateChanged = false;
|
||||||
break;
|
break;
|
||||||
// These states will be translated into literal strings which are used to
|
// These states will be translated into literal strings which are used to
|
||||||
// show the current status of this call.
|
// show the current status of this call.
|
||||||
case nsITelephonyService::CALL_STATE_DIALING:
|
case nsITelephonyService::CALL_STATE_DIALING:
|
||||||
stateString.AssignLiteral("dialing");
|
mState.AssignLiteral("dialing");
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_ALERTING:
|
case nsITelephonyService::CALL_STATE_ALERTING:
|
||||||
stateString.AssignLiteral("alerting");
|
mState.AssignLiteral("alerting");
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_CONNECTED:
|
case nsITelephonyService::CALL_STATE_CONNECTED:
|
||||||
stateString.AssignLiteral("connected");
|
mState.AssignLiteral("connected");
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_HELD:
|
case nsITelephonyService::CALL_STATE_HELD:
|
||||||
stateString.AssignLiteral("held");
|
mState.AssignLiteral("held");
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_DISCONNECTED:
|
case nsITelephonyService::CALL_STATE_DISCONNECTED:
|
||||||
stateString.AssignLiteral("disconnected");
|
mState.AssignLiteral("disconnected");
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_INCOMING:
|
case nsITelephonyService::CALL_STATE_INCOMING:
|
||||||
stateString.AssignLiteral("incoming");
|
mState.AssignLiteral("incoming");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("Unknown state!");
|
NS_NOTREACHED("Unknown state!");
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallState = aCallState;
|
|
||||||
if (!stateString.IsEmpty()) {
|
|
||||||
mState = stateString;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aCallState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
|
if (aCallState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
|
||||||
NS_ASSERTION(mLive, "Should be live!");
|
NS_ASSERTION(mLive, "Should be live!");
|
||||||
mLive = false;
|
mLive = false;
|
||||||
|
@ -144,7 +144,7 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFireEvents) {
|
if (aFireEvents && externalStateChanged) {
|
||||||
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("statechange"), this);
|
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("statechange"), this);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("Failed to dispatch specific event!");
|
NS_WARNING("Failed to dispatch specific event!");
|
||||||
|
@ -153,7 +153,7 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
|
||||||
// This can change if the statechange handler called back here... Need to
|
// This can change if the statechange handler called back here... Need to
|
||||||
// figure out something smarter.
|
// figure out something smarter.
|
||||||
if (mCallState == aCallState) {
|
if (mCallState == aCallState) {
|
||||||
rv = DispatchCallEvent(stateString, this);
|
rv = DispatchCallEvent(mState, this);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("Failed to dispatch specific event!");
|
NS_WARNING("Failed to dispatch specific event!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,41 +87,47 @@ TelephonyCallGroup::ChangeState(uint16_t aCallState)
|
||||||
if (mCallState == aCallState) {
|
if (mCallState == aCallState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Update the internal state.
|
||||||
|
mCallState = aCallState;
|
||||||
|
|
||||||
nsString stateString;
|
// Indicate whether the external state should be changed.
|
||||||
|
bool externalStateChanged = true;
|
||||||
switch (aCallState) {
|
switch (aCallState) {
|
||||||
|
// These states are used internally to mark this CallGroup is currently
|
||||||
|
// being controlled, and we should block consecutive requests of the same
|
||||||
|
// type according to these states.
|
||||||
|
case nsITelephonyService::CALL_STATE_HOLDING:
|
||||||
|
case nsITelephonyService::CALL_STATE_RESUMING:
|
||||||
|
externalStateChanged = false;
|
||||||
|
break;
|
||||||
|
// These states will be translated into literal strings which are used to
|
||||||
|
// show the current status of this CallGroup.
|
||||||
case nsITelephonyService::CALL_STATE_UNKNOWN:
|
case nsITelephonyService::CALL_STATE_UNKNOWN:
|
||||||
|
mState.AssignLiteral("");
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_CONNECTED:
|
case nsITelephonyService::CALL_STATE_CONNECTED:
|
||||||
stateString.AssignLiteral("connected");
|
mState.AssignLiteral("connected");
|
||||||
break;
|
|
||||||
case nsITelephonyService::CALL_STATE_HOLDING:
|
|
||||||
stateString.AssignLiteral("holding");
|
|
||||||
break;
|
break;
|
||||||
case nsITelephonyService::CALL_STATE_HELD:
|
case nsITelephonyService::CALL_STATE_HELD:
|
||||||
stateString.AssignLiteral("held");
|
mState.AssignLiteral("held");
|
||||||
break;
|
|
||||||
case nsITelephonyService::CALL_STATE_RESUMING:
|
|
||||||
stateString.AssignLiteral("resuming");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("Unknown state!");
|
NS_NOTREACHED("Unknown state!");
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = stateString;
|
if (externalStateChanged) {
|
||||||
mCallState = aCallState;
|
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("statechange"), nullptr);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("statechange"), nullptr);
|
NS_WARNING("Failed to dispatch specific event!");
|
||||||
if (NS_FAILED(rv)) {
|
}
|
||||||
NS_WARNING("Failed to dispatch specific event!");
|
if (!mState.IsEmpty()) {
|
||||||
}
|
// This can change if the statechange handler called back here... Need to
|
||||||
if (!stateString.IsEmpty()) {
|
// figure out something smarter.
|
||||||
// This can change if the statechange handler called back here... Need to
|
if (mCallState == aCallState) {
|
||||||
// figure out something smarter.
|
rv = DispatchCallEvent(mState, nullptr);
|
||||||
if (mCallState == aCallState) {
|
if (NS_FAILED(rv)) {
|
||||||
rv = DispatchCallEvent(stateString, nullptr);
|
NS_WARNING("Failed to dispatch specific event!");
|
||||||
if (NS_FAILED(rv)) {
|
}
|
||||||
NS_WARNING("Failed to dispatch specific event!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,7 @@ public:
|
||||||
|
|
||||||
IMPL_EVENT_HANDLER(statechange)
|
IMPL_EVENT_HANDLER(statechange)
|
||||||
IMPL_EVENT_HANDLER(connected)
|
IMPL_EVENT_HANDLER(connected)
|
||||||
IMPL_EVENT_HANDLER(holding)
|
|
||||||
IMPL_EVENT_HANDLER(held)
|
IMPL_EVENT_HANDLER(held)
|
||||||
IMPL_EVENT_HANDLER(resuming)
|
|
||||||
IMPL_EVENT_HANDLER(callschanged)
|
IMPL_EVENT_HANDLER(callschanged)
|
||||||
IMPL_EVENT_HANDLER(error)
|
IMPL_EVENT_HANDLER(error)
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче