diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index 2f3e3b20bb33..8424e0c0a50b 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -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 diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 1d5b226287a8..ea76edcdcddf 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -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 diff --git a/dom/network/interfaces/nsIDOMMobileConnection.idl b/dom/network/interfaces/nsIDOMMobileConnection.idl index da40d00a8fa1..75cf51a76db1 100644 --- a/dom/network/interfaces/nsIDOMMobileConnection.idl +++ b/dom/network/interfaces/nsIDOMMobileConnection.idl @@ -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. * diff --git a/dom/network/src/Makefile.in b/dom/network/src/Makefile.in index 93a761ecf5b9..72e960fb3c78 100644 --- a/dom/network/src/Makefile.in +++ b/dom/network/src/Makefile.in @@ -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 diff --git a/dom/network/src/MobileConnection.cpp b/dom/network/src/MobileConnection.cpp index 284991475e70..f2813cce0a8d 100644 --- a/dom/network/src/MobileConnection.cpp +++ b/dom/network/src/MobileConnection.cpp @@ -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) { diff --git a/dom/network/src/MobileConnection.h b/dom/network/src/MobileConnection.h index ab397ac7256f..4b0a64f1d329 100644 --- a/dom/network/src/MobileConnection.h +++ b/dom/network/src/MobileConnection.h @@ -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 mProvider; + nsRefPtr mIccManager; nsIDOMEventTarget* ToIDOMEventTarget() const