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

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: 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..31cba54dbb6818e73bea9ce80e5790c4d3783034 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,28 @@ 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);
+ return new remoting.FallbackSignalStrategy(
+ /**
+ * @param {function(remoting.SignalStrategy.State): void}
+ * onStateChangedCallback_
+ */
+ function(onStateChangedCallback_) {
Sergey Ulanov 2015/01/13 19:43:51 here and below: remove _ suffix from the name
Sergey Ulanov 2015/01/13 19:43:51 Maybe move this function out of the argument list,
Jamie 2015/01/14 01:36:26 Done.
Jamie 2015/01/14 01:36:26 Done.
+ return new remoting.XmppConnection(onStateChangedCallback_);
+ },
+ /**
+ * @param {function(remoting.SignalStrategy.State): void}
+ * onStateChangedCallback_
+ */
+ function(onStateChangedCallback_) {
+ return new remoting.WcsAdapter(onStateChangedCallback_);
+ },
+ onStateChangedCallback,
+ /**
+ * @param {remoting.FallbackSignalStrategy.Result} progress
+ */
+ function(progress) {
+ console.warn('FallbackStrategyProgress: ' + progress);
+ });
} else {
return new remoting.WcsAdapter(onStateChangedCallback);
}

Powered by Google App Engine
This is Rietveld 408576698