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_network_MobileConnection_h michael@0: #define mozilla_dom_network_MobileConnection_h michael@0: michael@0: #include "mozilla/DOMEventTargetHelper.h" michael@0: #include "nsIDOMMobileConnection.h" michael@0: #include "nsIMobileConnectionProvider.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsWeakPtr.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class MobileConnection : public DOMEventTargetHelper michael@0: , public nsIDOMMozMobileConnection michael@0: { michael@0: /** michael@0: * Class MobileConnection doesn't actually inherit michael@0: * nsIMobileConnectionListener. Instead, it owns an michael@0: * nsIMobileConnectionListener derived instance mListener and passes it to michael@0: * nsIMobileConnectionProvider. The onreceived events are first delivered to michael@0: * mListener and then forwarded to its owner, MobileConnection. See also bug michael@0: * 775997 comment #51. michael@0: */ michael@0: class Listener; michael@0: michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_NSIDOMMOZMOBILECONNECTION michael@0: NS_DECL_NSIMOBILECONNECTIONLISTENER michael@0: michael@0: NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) michael@0: michael@0: MobileConnection(uint32_t aClientId); michael@0: michael@0: void Init(nsPIDOMWindow *aWindow); michael@0: void Shutdown(); michael@0: michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MobileConnection, michael@0: DOMEventTargetHelper) michael@0: michael@0: private: michael@0: nsCOMPtr mProvider; michael@0: nsRefPtr mListener; michael@0: nsWeakPtr mWindow; michael@0: michael@0: uint32_t mClientId; michael@0: michael@0: bool CheckPermission(const char* aType); michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_network_MobileConnection_h