Index: remoting/webapp/signal_strategy.js |
diff --git a/remoting/webapp/signal_strategy.js b/remoting/webapp/signal_strategy.js |
index b94acc35e3708184abb6d46e7316512f9a4f89dc..c50041d55c56d6f2e99c35167fc73fc5d91aab51 100644 |
--- a/remoting/webapp/signal_strategy.js |
+++ b/remoting/webapp/signal_strategy.js |
@@ -65,3 +65,18 @@ remoting.SignalStrategy.prototype.getError = function() {}; |
/** @return {string} Current JID when in CONNECTED state. */ |
remoting.SignalStrategy.prototype.getJid = function() {}; |
+ |
+/** Creates the appropriate signal strategy for this environment. |
Sergey Ulanov
2014/09/25 02:28:46
nit: "/**" should be on its own line unless the wh
rmsousa
2014/09/27 01:42:17
Done.
|
+ * @param {function(remoting.SignalStrategy.State): void} onStateChangedCallback |
+ * @return {remoting.SignalStrategy} New signal strategy object. |
+ */ |
+remoting.SignalStrategy.create = function(onStateChangedCallback) { |
rmsousa
2014/09/24 02:53:27
I moved this here to keep the implementation selec
|
+ // Only use XMPP when TCP API is available and TLS support is enabled. That's |
+ // not the case for V1 app (socket API is available only to platform apps) |
+ // and for Chrome releases before 38. |
+ if (chrome.socket && chrome.socket.secure) { |
+ return new remoting.XmppConnection(onStateChangedCallback); |
+ } else { |
+ return new remoting.WcsAdapter(onStateChangedCallback); |
+ } |
+}; |