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: */
|
2015-01-15 19:58:40 +03: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_BroadcastChannelService_h
|
|
|
|
#define mozilla_dom_BroadcastChannelService_h
|
|
|
|
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nsHashKeys.h"
|
2016-05-24 10:37:23 +03:00
|
|
|
#include "nsTHashtable.h"
|
2015-01-15 19:58:40 +03:00
|
|
|
|
2015-01-15 19:58:42 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#undef PostMessage
|
|
|
|
#endif
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class BroadcastChannelParent;
|
2015-01-15 19:58:41 +03:00
|
|
|
class ClonedMessageData;
|
2015-01-15 19:58:40 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class BroadcastChannelService final
|
2015-01-15 19:58:40 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(BroadcastChannelService)
|
|
|
|
|
|
|
|
static already_AddRefed<BroadcastChannelService> GetOrCreate();
|
|
|
|
|
2016-05-24 10:37:23 +03:00
|
|
|
void RegisterActor(BroadcastChannelParent* aParent);
|
|
|
|
void UnregisterActor(BroadcastChannelParent* aParent);
|
2015-01-15 19:58:40 +03:00
|
|
|
|
|
|
|
void PostMessage(BroadcastChannelParent* aParent,
|
2015-01-15 19:58:41 +03:00
|
|
|
const ClonedMessageData& aData,
|
2016-05-24 10:37:23 +03:00
|
|
|
const nsACString& aOrigin,
|
|
|
|
const nsAString& aChannel,
|
|
|
|
bool aPrivateBrowsing);
|
2015-01-15 19:58:40 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
BroadcastChannelService();
|
|
|
|
~BroadcastChannelService();
|
|
|
|
|
2016-05-24 10:37:23 +03:00
|
|
|
nsTHashtable<nsPtrHashKey<BroadcastChannelParent>> mAgents;
|
2015-01-15 19:58:40 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2015-01-15 19:58:40 +03:00
|
|
|
|
|
|
|
#endif // mozilla_dom_BroadcastChannelService_h
|