michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_CellBroadcast_h__ michael@0: #define mozilla_dom_CellBroadcast_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/DOMEventTargetHelper.h" michael@0: #include "mozilla/ErrorResult.h" michael@0: #include "nsICellBroadcastProvider.h" michael@0: #include "js/TypeDecls.h" michael@0: michael@0: class nsPIDOMWindow; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class CellBroadcast MOZ_FINAL : public DOMEventTargetHelper michael@0: { michael@0: /** michael@0: * Class CellBroadcast doesn't actually inherit nsICellBroadcastListener. michael@0: * Instead, it owns an nsICellBroadcastListener derived instance mListener michael@0: * and passes it to nsICellBroadcastProvider. The onreceived events are first michael@0: * delivered to mListener and then forwarded to its owner, CellBroadcast. See michael@0: * also bug 775997 comment #51. michael@0: */ michael@0: class Listener; michael@0: michael@0: public: michael@0: NS_DECL_NSICELLBROADCASTLISTENER michael@0: michael@0: NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) michael@0: michael@0: static already_AddRefed michael@0: Create(nsPIDOMWindow* aOwner, ErrorResult& aRv); michael@0: michael@0: CellBroadcast() MOZ_DELETE; michael@0: CellBroadcast(nsPIDOMWindow *aWindow, michael@0: nsICellBroadcastProvider* aProvider); michael@0: // MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor michael@0: ~CellBroadcast(); michael@0: michael@0: nsPIDOMWindow* michael@0: GetParentObject() const { return GetOwner(); } michael@0: michael@0: virtual JSObject* michael@0: WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: IMPL_EVENT_HANDLER(received) michael@0: michael@0: private: michael@0: nsCOMPtr mProvider; michael@0: nsRefPtr mListener; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif /* mozilla_dom_CellBroadcast_h__ */