OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 module webmessaging.mojom; | |
6 | |
7 import "url/mojo/origin.mojom"; | |
8 | |
9 // A pair of BroadcastChannelClient interfaces is used to represent a connection | |
10 // to a particular channel. One client is implemented in the browser, for | |
11 // messages sent from the renderer to the browser, and one client is implemented | |
12 // in the renderer for messages from the browser to the renderer. | |
13 interface BroadcastChannelClient { | |
14 // Messages are passed as SerializedScriptValue. | |
15 OnMessage(string message); | |
16 }; | |
17 | |
18 // This interface is used to set up connections to broadcast channels. All | |
19 // connections to channels made from the same event loop should be made | |
20 // through the same BroadcastChannelProvider connection to ensure correct | |
21 // ordering of messages. | |
22 // Typically the browser will have one instance of a BroadcastChannelProvider | |
23 // per storage partition, to which all connections from renderers in that | |
24 // partition are bound. This instance will then forward messages received on a | |
25 // particular connection to all other connections in the same storage partition | |
26 // with the same origin and name. | |
27 interface BroadcastChannelProvider { | |
28 // Connect to the channel identified by the |origin| and |name|. Messages can | |
29 // be sent to the channel using |sender|, and messages to the channel will be | |
30 // received by |receiver|. | |
31 ConnectToChannel(url.mojom.Origin origin, string name, | |
32 associated BroadcastChannelClient receiver, | |
33 associated BroadcastChannelClient& sender); | |
34 }; | |
OLD | NEW |