зеркало из https://github.com/mozilla/gecko-dev.git
Bug 744714 - Part 5: Add icc into MobileConnection. r=smaug, sr=sicking
This commit is contained in:
Родитель
ddd3985dc2
Коммит
e74ac3adb1
|
@ -160,6 +160,7 @@
|
|||
@BINPATH@/components/dom_telephony.xpt
|
||||
@BINPATH@/components/dom_wifi.xpt
|
||||
@BINPATH@/components/dom_system_gonk.xpt
|
||||
@BINPATH@/components/dom_icc.xpt
|
||||
#endif
|
||||
@BINPATH@/components/dom_battery.xpt
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
|
|
@ -169,6 +169,7 @@
|
|||
@BINPATH@/components/dom_telephony.xpt
|
||||
@BINPATH@/components/dom_wifi.xpt
|
||||
@BINPATH@/components/dom_system_gonk.xpt
|
||||
@BINPATH@/components/dom_icc.xpt
|
||||
#endif
|
||||
@BINPATH@/components/dom_battery.xpt
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
|
|
@ -9,8 +9,9 @@ interface nsIDOMDOMRequest;
|
|||
interface nsIDOMMozMobileConnectionInfo;
|
||||
interface nsIDOMMozMobileNetworkInfo;
|
||||
interface nsIDOMMozMobileCellInfo;
|
||||
interface nsIDOMMozIccManager;
|
||||
|
||||
[scriptable, builtinclass, uuid(e7309c47-9a2e-4e12-84ab-f8f39214eaba)]
|
||||
[scriptable, builtinclass, uuid(46fa4f72-9c81-4b7f-b395-87202966e526)]
|
||||
interface nsIDOMMozMobileConnection : nsIDOMEventTarget
|
||||
{
|
||||
/**
|
||||
|
@ -38,6 +39,11 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
|
|||
*/
|
||||
readonly attribute DOMString networkSelectionMode;
|
||||
|
||||
/**
|
||||
* IccManager provides access to ICC related funcionality.
|
||||
*/
|
||||
readonly attribute nsIDOMMozIccManager icc;
|
||||
|
||||
/**
|
||||
* Search for available networks.
|
||||
*
|
||||
|
|
|
@ -44,6 +44,12 @@ LOCAL_INCLUDES = \
|
|||
-I$(topsrcdir)/content/events/src \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/dom/icc/src \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "USSDReceivedEvent.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "IccManager.h"
|
||||
|
||||
#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
|
||||
|
||||
|
@ -45,6 +46,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MobileConnection,
|
|||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(datachange)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(ussdreceived)
|
||||
tmp->mProvider = nullptr;
|
||||
tmp->mIccManager = nullptr;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MobileConnection)
|
||||
|
@ -82,6 +84,9 @@ MobileConnection::Init(nsPIDOMWindow* aWindow)
|
|||
obs->AddObserver(this, kDataChangedTopic, false);
|
||||
obs->AddObserver(this, kCardStateChangedTopic, false);
|
||||
obs->AddObserver(this, kUssdReceivedTopic, false);
|
||||
|
||||
mIccManager = new icc::IccManager();
|
||||
mIccManager->Init(aWindow);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -97,6 +102,11 @@ MobileConnection::Shutdown()
|
|||
obs->RemoveObserver(this, kDataChangedTopic);
|
||||
obs->RemoveObserver(this, kCardStateChangedTopic);
|
||||
obs->RemoveObserver(this, kUssdReceivedTopic);
|
||||
|
||||
if (mIccManager) {
|
||||
mIccManager->Shutdown();
|
||||
mIccManager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// nsIObserver
|
||||
|
@ -180,6 +190,13 @@ MobileConnection::GetNetworkSelectionMode(nsAString& networkSelectionMode)
|
|||
return mProvider->GetNetworkSelectionMode(networkSelectionMode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnection::GetIcc(nsIDOMMozIccManager** aIcc)
|
||||
{
|
||||
NS_IF_ADDREF(*aIcc = mIccManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnection::GetNetworks(nsIDOMDOMRequest** request)
|
||||
{
|
||||
|
|
|
@ -10,9 +10,15 @@
|
|||
#include "nsIMobileConnectionProvider.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "IccManager.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace icc {
|
||||
class IccManager;
|
||||
} // namespace icc
|
||||
|
||||
namespace network {
|
||||
|
||||
class MobileConnection : public nsDOMEventTargetHelper
|
||||
|
@ -36,6 +42,7 @@ public:
|
|||
|
||||
private:
|
||||
nsCOMPtr<nsIMobileConnectionProvider> mProvider;
|
||||
nsRefPtr<icc::IccManager> mIccManager;
|
||||
|
||||
nsIDOMEventTarget*
|
||||
ToIDOMEventTarget() const
|
||||
|
|
Загрузка…
Ссылка в новой задаче