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

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: One bird per stone 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..e039783273b6c462e57bc24fde01b1cc0f73b481 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------ |
@@ -109,11 +116,18 @@ remoting.It2MeHelperChannel =
/** @enum {string} */
remoting.It2MeHelperChannel.HangoutMessageTypes = {
+ HELLO: 'hello',
+ HELLO_RESPONSE: 'helloResponse',
CONNECT: 'connect',
DISCONNECT: 'disconnect'
};
/** @enum {string} */
+remoting.It2MeHelperChannel.Features = {
+ REMOTE_ASSISTANCE: 'remoteAssistance'
+};
+
+/** @enum {string} */
remoting.It2MeHelperChannel.WebappMessageTypes = {
SESSION_STATE_CHANGED: 'sessionStateChanged'
};
@@ -143,7 +157,14 @@ remoting.It2MeHelperChannel.prototype.onHangoutMessage_ = function(message) {
case MessageTypes.DISCONNECT:
this.closeWebapp_(message);
return true;
+ case MessageTypes.HELLO:
+ this.hangoutPort_.postMessage({
+ method: MessageTypes.HELLO_RESPONSE,
+ supportedFeatures: base.values(remoting.It2MeHelperChannel.Features)
+ });
+ return true;
}
+ throw new Error('Unknown message method=' + message.method);
} catch(e) {
var error = /** @type {Error} */ e;
console.error(error);
« no previous file with comments | « no previous file | remoting/webapp/background/it2me_service.js » ('j') | remoting/webapp/unittests/it2me_helper_channel_unittest.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698