Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Unified Diff: components/webmessaging/broadcast_channel_provider.h

Issue 2004643002: Implement BroadcastChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address dcheng's comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/webmessaging/OWNERS ('k') | components/webmessaging/broadcast_channel_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webmessaging/broadcast_channel_provider.h
diff --git a/components/webmessaging/broadcast_channel_provider.h b/components/webmessaging/broadcast_channel_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..1b4904bc6aac0d75e73275bef966de4da9223b36
--- /dev/null
+++ b/components/webmessaging/broadcast_channel_provider.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WEBMESSAGING_BROADCAST_CHANNEL_PROVIDER_H_
+#define COMPONENTS_WEBMESSAGING_BROADCAST_CHANNEL_PROVIDER_H_
+
+#include <map>
+
+#include "base/memory/ref_counted.h"
+#include "components/webmessaging/public/interfaces/broadcast_channel.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "url/origin.h"
+
+namespace webmessaging {
+
+class BroadcastChannelProvider
+ : public base::RefCountedThreadSafe<BroadcastChannelProvider>,
+ public mojom::BroadcastChannelProvider {
+ public:
+ BroadcastChannelProvider();
+ void Connect(mojo::InterfaceRequest<mojom::BroadcastChannelProvider> request);
+
+ void ConnectToChannel(
+ const url::Origin& origin,
+ const mojo::String& name,
+ mojom::BroadcastChannelClientAssociatedPtrInfo client,
+ mojom::BroadcastChannelClientAssociatedRequest connection) override;
+
+ private:
+ friend class base::RefCountedThreadSafe<BroadcastChannelProvider>;
+ class Connection;
+
+ ~BroadcastChannelProvider() override;
+
+ void UnregisterConnection(Connection*);
+ void ReceivedMessageOnConnection(Connection*, const mojo::String& message);
+
+ mojo::BindingSet<mojom::BroadcastChannelProvider> bindings_;
+ std::map<url::Origin, std::multimap<std::string, std::unique_ptr<Connection>>>
+ connections_;
+};
+
+} // namespace webmessaging
+
+#endif // COMPONENTS_WEBMESSAGING_BROADCAST_CHANNEL_PROVIDER_H_
« no previous file with comments | « components/webmessaging/OWNERS ('k') | components/webmessaging/broadcast_channel_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698