2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-12-04 06:38:25 +04:00
|
|
|
/* 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-27 07:38:37 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-04-01 10:13:50 +04:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
2013-08-27 07:38:37 +04:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2014-08-13 14:28:34 +04:00
|
|
|
#include "nsICellBroadcastService.h"
|
2013-08-28 06:59:14 +04:00
|
|
|
#include "js/TypeDecls.h"
|
2012-12-04 06:38:25 +04:00
|
|
|
|
|
|
|
class nsPIDOMWindow;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class CellBroadcast final : public DOMEventTargetHelper,
|
2014-08-20 05:01:49 +04:00
|
|
|
private nsICellBroadcastListener
|
2012-12-04 06:38:25 +04:00
|
|
|
{
|
2012-12-04 06:40:47 +04:00
|
|
|
/**
|
2014-08-20 05:01:49 +04:00
|
|
|
* Class CellBroadcast doesn't actually expose nsICellBroadcastListener.
|
2013-03-06 13:53:15 +04:00
|
|
|
* Instead, it owns an nsICellBroadcastListener derived instance mListener
|
2014-08-13 14:28:34 +04:00
|
|
|
* and passes it to nsICellBroadcastService. The onreceived events are first
|
2013-03-06 13:53:15 +04:00
|
|
|
* delivered to mListener and then forwarded to its owner, CellBroadcast. See
|
|
|
|
* also bug 775997 comment #51.
|
2012-12-04 06:40:47 +04:00
|
|
|
*/
|
2013-03-06 13:53:15 +04:00
|
|
|
class Listener;
|
2012-12-04 06:40:47 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
// final suppresses -Werror,-Wdelete-non-virtual-dtor
|
2014-08-20 05:01:49 +04:00
|
|
|
~CellBroadcast();
|
|
|
|
|
2013-03-06 13:53:15 +04:00
|
|
|
public:
|
2014-08-20 05:01:49 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2013-03-06 13:53:15 +04:00
|
|
|
NS_DECL_NSICELLBROADCASTLISTENER
|
2012-12-04 06:38:25 +04:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
2012-12-04 06:38:25 +04:00
|
|
|
|
2013-08-27 07:38:37 +04:00
|
|
|
static already_AddRefed<CellBroadcast>
|
|
|
|
Create(nsPIDOMWindow* aOwner, ErrorResult& aRv);
|
|
|
|
|
2015-01-07 02:35:02 +03:00
|
|
|
CellBroadcast() = delete;
|
2012-12-04 06:40:47 +04:00
|
|
|
CellBroadcast(nsPIDOMWindow *aWindow,
|
2014-08-13 14:28:34 +04:00
|
|
|
nsICellBroadcastService* aService);
|
2012-12-04 06:40:47 +04:00
|
|
|
|
2013-08-27 07:38:37 +04:00
|
|
|
nsPIDOMWindow*
|
|
|
|
GetParentObject() const { return GetOwner(); }
|
|
|
|
|
|
|
|
virtual JSObject*
|
2015-03-21 19:28:04 +03:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-08-27 07:38:37 +04:00
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(received)
|
|
|
|
|
2012-12-04 06:40:47 +04:00
|
|
|
private:
|
2013-03-06 13:53:15 +04:00
|
|
|
nsRefPtr<Listener> mListener;
|
2012-12-04 06:38:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-08-27 07:38:37 +04:00
|
|
|
#endif /* mozilla_dom_CellBroadcast_h__ */
|