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

Unified Diff: remoting/webapp/crd/js/signal_strategy.js

Issue 815943004: Implement FallbackSignalStrategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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/crd/js/signal_strategy.js
diff --git a/remoting/webapp/crd/js/signal_strategy.js b/remoting/webapp/crd/js/signal_strategy.js
index 02c8acbd5f0cc27829d59aa1b6dbd8a6f020b57b..f07613f9bd3a71175197341e38896592fce4788f 100644
--- a/remoting/webapp/crd/js/signal_strategy.js
+++ b/remoting/webapp/crd/js/signal_strategy.js
@@ -23,6 +23,8 @@ remoting.SignalStrategy = function() {};
* CONNECTING -> FAILED (connection failed).
* HANDSHAKE -> FAILED (authentication failed).
* * -> CLOSED (dispose() called).
+ *
+ * Do not re-order these values without updating fallback_signal_strategy.js.
*/
remoting.SignalStrategy.State = {
NOT_CONNECTED: 0,
@@ -76,7 +78,30 @@ remoting.SignalStrategy.create = function(onStateChangedCallback) {
// 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);
+ /**
+ * @param {function(remoting.SignalStrategy.State): void} onStateChanged
+ */
+ var xmppFactory = function(onStateChanged) {
+ return new remoting.XmppConnection(onStateChanged);
+ };
+
+ /**
+ * @param {function(remoting.SignalStrategy.State): void} onStateChanged
+ */
+ var wcsFactory = function(onStateChanged) {
+ return new remoting.WcsAdapter(onStateChanged);
+ };
+
+ /**
+ * @param {remoting.FallbackSignalStrategy.Progress} progress
+ */
+ var progressCallback = function(progress) {
+ console.log('FallbackSignalStrategy progress: ' + progress);
+ };
+
+ return new remoting.FallbackSignalStrategy(
+ xmppFactory, wcsFactory, onStateChangedCallback, progressCallback);
+
} else {
return new remoting.WcsAdapter(onStateChangedCallback);
}
« no previous file with comments | « remoting/webapp/crd/js/fallback_signal_strategy.js ('k') | remoting/webapp/unittests/fallback_signal_strategy_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698