Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: remoting/webapp/background/it2me_helper_channel.js

Issue 473073002: Move hello message from It2MeService to It2MeChannel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« no previous file with comments | « no previous file | remoting/webapp/background/it2me_service.js » ('j') | remoting/webapp/background/it2me_service.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698