Bug 875721 - Part 2: Move iccInfo related attribute/event from mozMobileConnection to mozIccManager (DOM). r=smaug

This commit is contained in:
Edgar Chen 2013-05-30 18:36:10 +08:00
parent e482150a75
commit 69b1b1a79a
2 changed files with 20 additions and 22 deletions

View File

@ -5,6 +5,7 @@
#include "mozilla/Services.h"
#include "nsIDOMClassInfo.h"
#include "nsIDOMIccCardLockErrorEvent.h"
#include "nsIDOMIccInfo.h"
#include "GeneratedEvents.h"
#include "IccManager.h"
#include "SimToolKit.h"
@ -129,6 +130,18 @@ IccManager::SendStkEventDownload(const JS::Value& aEvent)
return NS_OK;
}
NS_IMETHODIMP
IccManager::GetIccInfo(nsIDOMMozIccInfo** aIccInfo)
{
*aIccInfo = nullptr;
if (!mProvider) {
return NS_ERROR_FAILURE;
}
return mProvider->GetIccInfo(aIccInfo);
}
NS_IMETHODIMP
IccManager::GetCardState(nsAString& cardState)
{
@ -237,6 +250,7 @@ NS_IMPL_EVENT_HANDLER(IccManager, stkcommand)
NS_IMPL_EVENT_HANDLER(IccManager, stksessionend)
NS_IMPL_EVENT_HANDLER(IccManager, icccardlockerror)
NS_IMPL_EVENT_HANDLER(IccManager, cardstatechange)
NS_IMPL_EVENT_HANDLER(IccManager, iccinfochange)
// nsIIccListener
@ -274,4 +288,10 @@ NS_IMETHODIMP
IccManager::NotifyCardStateChanged()
{
return DispatchTrustedEvent(NS_LITERAL_STRING("cardstatechange"));
}
NS_IMETHODIMP
IccManager::NotifyIccInfoChanged()
{
return DispatchTrustedEvent(NS_LITERAL_STRING("iccinfochange"));
}

View File

@ -67,7 +67,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(MobileConnection, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(MobileConnection, nsDOMEventTargetHelper)
NS_IMPL_EVENT_HANDLER(MobileConnection, iccinfochange)
NS_IMPL_EVENT_HANDLER(MobileConnection, voicechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, datachange)
NS_IMPL_EVENT_HANDLER(MobileConnection, ussdreceived)
@ -172,17 +171,6 @@ MobileConnection::GetRetryCount(int32_t* retryCount)
return mProvider->GetRetryCount(retryCount);
}
NS_IMETHODIMP
MobileConnection::GetIccInfo(nsIDOMMozMobileICCInfo** aIccInfo)
{
*aIccInfo = nullptr;
if (!mProvider || !CheckPermission("mobileconnection")) {
return NS_OK;
}
return mProvider->GetIccInfo(aIccInfo);
}
NS_IMETHODIMP
MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
{
@ -416,16 +404,6 @@ MobileConnection::NotifyDataChanged()
return DispatchTrustedEvent(NS_LITERAL_STRING("datachange"));
}
NS_IMETHODIMP
MobileConnection::NotifyIccInfoChanged()
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
return DispatchTrustedEvent(NS_LITERAL_STRING("iccinfochange"));
}
NS_IMETHODIMP
MobileConnection::NotifyUssdReceived(const nsAString& aMessage,
bool aSessionEnded)