Index: components/webmessaging/public/interfaces/broadcast_channel.mojom |
diff --git a/components/webmessaging/public/interfaces/broadcast_channel.mojom b/components/webmessaging/public/interfaces/broadcast_channel.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fedc6df534f42ee0232845257ce0cf27c5225402 |
--- /dev/null |
+++ b/components/webmessaging/public/interfaces/broadcast_channel.mojom |
@@ -0,0 +1,34 @@ |
+// 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. |
+ |
+module webmessaging.mojom; |
+ |
+import "url/mojo/origin.mojom"; |
+ |
+// A pair of BroadcastChannelClient interfaces is used to represent a connection |
+// to a particular channel. One client is implemented in the browser, for |
+// messages sent from the renderer to the browser, and one client is implemented |
+// in the renderer for messages from the browser to the renderer. |
+interface BroadcastChannelClient { |
+ // Messages are passed as SerializedScriptValue. |
+ OnMessage(string message); |
+}; |
+ |
+// This interface is used to set up connections to broadcast channels. All |
+// connections to channels made from the same event loop should be made |
+// through the same BroadcastChannelProvider connection to ensure correct |
+// ordering of messages. |
+// Typically the browser will have one instance of a BroadcastChannelProvider |
+// per storage partition, to which all connections from renderers in that |
+// partition are bound. This instance will then forward messages received on a |
+// particular connection to all other connections in the same storage partition |
+// with the same origin and name. |
+interface BroadcastChannelProvider { |
+ // Connect to the channel identified by the |origin| and |name|. Messages can |
+ // be sent to the channel using |sender|, and messages to the channel will be |
+ // received by |receiver|. |
+ ConnectToChannel(url.mojom.Origin origin, string name, |
+ associated BroadcastChannelClient receiver, |
+ associated BroadcastChannelClient& sender); |
+}; |