OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Interface abstracting the protocol extension functionality. | 7 * Interface abstracting the protocol extension functionality. |
8 * Instances of this class can be registered with the SessionConnector | 8 * Instances of this class can be registered with the SessionConnector |
9 * to enhance the communication protocol between the host and client. | 9 * to enhance the communication protocol between the host and client. |
10 * Note that corresponding support on the host side is required. | 10 * Note that corresponding support on the host side is required. |
11 */ | 11 */ |
12 | 12 |
13 'use strict'; | 13 'use strict'; |
14 | 14 |
15 /** @suppress {duplicate} */ | 15 /** @suppress {duplicate} */ |
16 var remoting = remoting || {}; | 16 var remoting = remoting || {}; |
17 | 17 |
18 /** | 18 /** |
19 * @interface | 19 * @interface |
20 */ | 20 */ |
21 remoting.ProtocolExtension = function() {}; | 21 remoting.ProtocolExtension = function() {}; |
22 | 22 |
23 /** | 23 /** |
24 * The string that identifies the type of the extension. | 24 * Return a list of the extension message types that this class can handle. |
25 * All extension messages with this type will be sent to the extension. | 25 * All extension messages that match these types will be sent to the extension. |
26 * | 26 * |
27 * @return {string} | 27 * @return {Array<string>} |
28 */ | 28 */ |
29 remoting.ProtocolExtension.prototype.getType = function() {}; | 29 remoting.ProtocolExtension.prototype.getExtensionTypes = function() {}; |
30 | 30 |
31 /** | 31 /** |
32 * Called when the connection has been established to start the extension. | 32 * Called when the connection has been established to start the extension. |
33 * | 33 * |
34 * @param {function(string,string)} sendMessageToHost Callback to send a message | 34 * @param {function(string,string)} sendMessageToHost Callback to send a message |
35 * to the host. | 35 * to the host. |
36 */ | 36 */ |
37 remoting.ProtocolExtension.prototype.start = | 37 remoting.ProtocolExtension.prototype.startExtension = |
38 function(sendMessageToHost) {}; | 38 function(sendMessageToHost) {}; |
39 | 39 |
40 /** | 40 /** |
41 * Called when an extension message of a matching type is received. | 41 * Called when an extension message of a matching type is received. |
42 * | 42 * |
43 * @param {string} message | 43 * @param {string} type The message type. |
| 44 * @param {Object} message The parsed extension message data. |
| 45 * @return {boolean} True if the extension message was handled. |
44 */ | 46 */ |
45 remoting.ProtocolExtension.prototype.onMessage = | 47 remoting.ProtocolExtension.prototype.onExtensionMessage = |
46 function(message) {}; | 48 function(type, message) {}; |
OLD | NEW |