Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / remoting / webapp / base / js / protocol_extension.js
blob28103f76fda01da32ef23ed7cb2f2e5ee5688c8c
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
3 // found in the LICENSE file.
5 /**
6 * @fileoverview
7 * Interface abstracting the protocol extension functionality.
8 * Instances of this class can be registered with the SessionConnector
9 * to enhance the communication protocol between the host and client.
10 * Note that corresponding support on the host side is required.
13 'use strict';
15 /** @suppress {duplicate} */
16 var remoting = remoting || {};
18 /**
19 * @interface
21 remoting.ProtocolExtension = function() {};
23 /**
24 * Return a list of the extension message types that this class can handle.
25 * All extension messages that match these types will be sent to the extension.
27 * @return {Array<string>}
29 remoting.ProtocolExtension.prototype.getExtensionTypes = function() {};
31 /**
32 * Called when the connection has been established to start the extension.
34 * @param {function(string,string)} sendMessageToHost Callback to send a message
35 * to the host.
37 remoting.ProtocolExtension.prototype.startExtension =
38 function(sendMessageToHost) {};
40 /**
41 * Called when an extension message of a matching type is received.
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.
47 remoting.ProtocolExtension.prototype.onExtensionMessage =
48 function(type, message) {};