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