2012-12-03 18:38:25 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_CellBroadcast_h__
|
|
|
|
#define mozilla_dom_CellBroadcast_h__
|
|
|
|
|
2013-08-26 20:38:37 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-31 23:13:50 -07:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
2013-08-26 20:38:37 -07:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2014-08-13 03:28:34 -07:00
|
|
|
#include "nsICellBroadcastService.h"
|
2013-08-27 19:59:14 -07:00
|
|
|
#include "js/TypeDecls.h"
|
2012-12-03 18:38:25 -08:00
|
|
|
|
|
|
|
class nsPIDOMWindow;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-08-19 18:01:49 -07:00
|
|
|
class CellBroadcast MOZ_FINAL : public DOMEventTargetHelper,
|
|
|
|
private nsICellBroadcastListener
|
2012-12-03 18:38:25 -08:00
|
|
|
{
|
2012-12-03 18:40:47 -08:00
|
|
|
/**
|
2014-08-19 18:01:49 -07:00
|
|
|
* Class CellBroadcast doesn't actually expose nsICellBroadcastListener.
|
2013-03-06 01:53:15 -08:00
|
|
|
* Instead, it owns an nsICellBroadcastListener derived instance mListener
|
2014-08-13 03:28:34 -07:00
|
|
|
* and passes it to nsICellBroadcastService. The onreceived events are first
|
2013-03-06 01:53:15 -08:00
|
|
|
* delivered to mListener and then forwarded to its owner, CellBroadcast. See
|
|
|
|
* also bug 775997 comment #51.
|
2012-12-03 18:40:47 -08:00
|
|
|
*/
|
2013-03-06 01:53:15 -08:00
|
|
|
class Listener;
|
2012-12-03 18:40:47 -08:00
|
|
|
|
2014-08-19 18:01:49 -07:00
|
|
|
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
|
|
|
|
~CellBroadcast();
|
|
|
|
|
2013-03-06 01:53:15 -08:00
|
|
|
public:
|
2014-08-19 18:01:49 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2013-03-06 01:53:15 -08:00
|
|
|
NS_DECL_NSICELLBROADCASTLISTENER
|
2012-12-03 18:38:25 -08:00
|
|
|
|
2014-03-31 23:13:50 -07:00
|
|
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
2012-12-03 18:38:25 -08:00
|
|
|
|
2013-08-26 20:38:37 -07:00
|
|
|
static already_AddRefed<CellBroadcast>
|
|
|
|
Create(nsPIDOMWindow* aOwner, ErrorResult& aRv);
|
|
|
|
|
2012-12-03 18:38:25 -08:00
|
|
|
CellBroadcast() MOZ_DELETE;
|
2012-12-03 18:40:47 -08:00
|
|
|
CellBroadcast(nsPIDOMWindow *aWindow,
|
2014-08-13 03:28:34 -07:00
|
|
|
nsICellBroadcastService* aService);
|
2012-12-03 18:40:47 -08:00
|
|
|
|
2013-08-26 20:38:37 -07:00
|
|
|
nsPIDOMWindow*
|
|
|
|
GetParentObject() const { return GetOwner(); }
|
|
|
|
|
|
|
|
virtual JSObject*
|
2014-04-08 15:27:18 -07:00
|
|
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2013-08-26 20:38:37 -07:00
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(received)
|
|
|
|
|
2012-12-03 18:40:47 -08:00
|
|
|
private:
|
2013-03-06 01:53:15 -08:00
|
|
|
nsRefPtr<Listener> mListener;
|
2012-12-03 18:38:25 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-08-26 20:38:37 -07:00
|
|
|
#endif /* mozilla_dom_CellBroadcast_h__ */
|