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