Chromium Code Reviews| Index: remoting/webapp/background/it2me_helper_channel.js |
| diff --git a/remoting/webapp/background/it2me_helper_channel.js b/remoting/webapp/background/it2me_helper_channel.js |
| index e25c443b6a64cd848bd595b91dbae9ecce908b84..efe059df3e1936674b2508ce6346fd8ca089a118 100644 |
| --- a/remoting/webapp/background/it2me_helper_channel.js |
| +++ b/remoting/webapp/background/it2me_helper_channel.js |
| @@ -10,13 +10,20 @@ |
| * assistance). |
| * |
| * It runs in the background page and contains two chrome.runtime.Port objects, |
| - * respresenting connections to the webapp and hangout, respectively. |
| + * representing connections to the webapp and hangout, respectively. |
| * |
| - * Connection is always initiated from Hangouts. |
| + * Connection is always initiated from Hangouts by calling |
| + * var port = chrome.runtime.connect({name:'it2me.helper.hangout'}, extId). |
| + * port.postMessage('hello') |
| + * If the webapp is not installed, |port.onDisconnect| will fire. |
| + * If the webapp is installed, Hangouts will receive a hello response with the |
| + * list of supported features. |
| * |
| * Hangout It2MeHelperChannel Chrome Remote Desktop |
| * |-----runtime.connect() ------>| | |
| - * |------connect message-------->| | |
| + * |--------hello message-------->| | |
| + * | |<-----helloResponse message-----| |
| + * |-------connect message------->| | |
| * | |-------appLauncher.launch()---->| |
| * | |<------runtime.connect()------- | |
| * | |<-----sessionStateChanged------ | |
| @@ -110,7 +117,8 @@ remoting.It2MeHelperChannel = |
| /** @enum {string} */ |
| remoting.It2MeHelperChannel.HangoutMessageTypes = { |
| CONNECT: 'connect', |
| - DISCONNECT: 'disconnect' |
| + DISCONNECT: 'disconnect', |
| + HELLO: 'hello' |
| }; |
| /** @enum {string} */ |
| @@ -143,6 +151,13 @@ remoting.It2MeHelperChannel.prototype.onHangoutMessage_ = function(message) { |
| case MessageTypes.DISCONNECT: |
| this.closeWebapp_(message); |
| return true; |
| + case MessageTypes.HELLO: |
| + this.hangoutPort_.postMessage({ |
| + method: message.method + 'Response', |
|
Jamie
2014/08/15 19:11:46
I think that helloResponse would be better declare
kelvinp
2014/08/15 21:28:32
Done.
|
| + supportedFeatures: |
| + base.values(remoting.It2MeHelperChannel.HangoutMessageTypes) |
|
Jamie
2014/08/15 19:11:46
I don't think that requiring a 1-1 mapping of feat
kelvinp
2014/08/15 21:28:32
Done.
|
| + }); |
| + return true; |
| } |
| } catch(e) { |
| var error = /** @type {Error} */ e; |