michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_IccListener_h michael@0: #define mozilla_dom_IccListener_h michael@0: michael@0: #include "nsAutoPtr.h" michael@0: #include "nsIIccProvider.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class IccManager; michael@0: class Icc; michael@0: michael@0: class IccListener : public nsIIccListener michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIICCLISTENER michael@0: michael@0: IccListener(IccManager* aIccManager, uint32_t aClientId); michael@0: ~IccListener(); michael@0: michael@0: void michael@0: Shutdown(); michael@0: michael@0: already_AddRefed michael@0: GetIcc() michael@0: { michael@0: nsRefPtr icc = mIcc; michael@0: return icc.forget(); michael@0: } michael@0: michael@0: private: michael@0: uint32_t mClientId; michael@0: // We did not setup 'mIcc' and 'mIccManager' being a participant of cycle michael@0: // collection is because in Navigator->Invalidate() it will call michael@0: // mIccManager->Shutdown(), then IccManager will call Shutdown() of each michael@0: // IccListener, this will release the reference and break the cycle. michael@0: nsRefPtr mIcc; michael@0: nsRefPtr mIccManager; michael@0: // mProvider is a xpcom service and will be released at shutdown, so it michael@0: // doesn't need to be cycle collected. michael@0: nsCOMPtr mProvider; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_IccListener_h