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

Side by Side Diff: remoting/webapp/crd/js/signal_strategy.js

Issue 1133913002: [Chromoting] Move shared webapp JS files from crd/js -> base/js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « remoting/webapp/crd/js/server_log_entry.js ('k') | remoting/webapp/crd/js/smart_reconnector.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 /** @suppress {duplicate} */
8 var remoting = remoting || {};
9
10 /**
11 * Abstract interface for various signaling mechanisms.
12 *
13 * @interface
14 * @extends {base.Disposable}
15 */
16 remoting.SignalStrategy = function() {};
17
18 /**
19 * @enum {number} SignalStrategy states. Possible state transitions:
20 * NOT_CONNECTED -> CONNECTING (connect() called).
21 * CONNECTING -> HANDSHAKE (connected successfully).
22 * HANDSHAKE -> CONNECTED (authenticated successfully).
23 * CONNECTING -> FAILED (connection failed).
24 * HANDSHAKE -> FAILED (authentication failed).
25 * CONNECTED -> FAILED (connection was terminated).
26 * * -> CLOSED (dispose() called).
27 *
28 * Do not re-order these values without updating fallback_signal_strategy.js.
29 */
30 remoting.SignalStrategy.State = {
31 NOT_CONNECTED: 0,
32 CONNECTING: 1,
33 HANDSHAKE: 2,
34 CONNECTED: 3,
35 FAILED: 4,
36 CLOSED: 5
37 };
38
39 /**
40 * @enum {string} SignalStrategy types. Do not add to these values without
41 * updating the corresponding enum in chromoting_extensions.proto.
42 */
43 remoting.SignalStrategy.Type = {
44 XMPP: 'xmpp',
45 WCS: 'wcs'
46 };
47
48 remoting.SignalStrategy.prototype.dispose = function() {};
49
50 /**
51 * @param {function(remoting.SignalStrategy.State):void} onStateChangedCallback
52 * Callback to call on state change.
53 */
54 remoting.SignalStrategy.prototype.setStateChangedCallback =
55 function(onStateChangedCallback) {};
56
57 /**
58 * @param {?function(Element):void} onIncomingStanzaCallback Callback to call on
59 * incoming messages.
60 */
61 remoting.SignalStrategy.prototype.setIncomingStanzaCallback =
62 function(onIncomingStanzaCallback) {};
63
64 /**
65 * @param {string} server
66 * @param {string} username
67 * @param {string} authToken
68 */
69 remoting.SignalStrategy.prototype.connect =
70 function(server, username, authToken) {
71 };
72
73 /**
74 * Sends a message. Can be called only in CONNECTED state.
75 * @param {string} message
76 */
77 remoting.SignalStrategy.prototype.sendMessage = function(message) {};
78
79 /**
80 * Send any messages accumulated during connection set-up.
81 *
82 * @param {remoting.LogToServer} logToServer The LogToServer instance for the
83 * connection.
84 */
85 remoting.SignalStrategy.prototype.sendConnectionSetupResults =
86 function(logToServer) {
87 };
88
89 /** @return {remoting.SignalStrategy.State} Current state */
90 remoting.SignalStrategy.prototype.getState = function() {};
91
92 /** @return {!remoting.Error} Error when in FAILED state. */
93 remoting.SignalStrategy.prototype.getError = function() {};
94
95 /** @return {string} Current JID when in CONNECTED state. */
96 remoting.SignalStrategy.prototype.getJid = function() {};
97
98 /** @return {remoting.SignalStrategy.Type} The signal strategy type. */
99 remoting.SignalStrategy.prototype.getType = function() {};
100
101 /**
102 * Creates the appropriate signal strategy for the current environment.
103 * @return {remoting.SignalStrategy} New signal strategy object.
104 */
105 remoting.SignalStrategy.create = function() {
106 // Only use XMPP when TCP API is available and TLS support is enabled. That's
107 // not the case for V1 app (socket API is available only to platform apps)
108 // and for Chrome releases before 38.
109 if (chrome.socket && chrome.socket.secure) {
110 /**
111 * @param {remoting.FallbackSignalStrategy.Progress} progress
112 */
113 var progressCallback = function(progress) {
114 console.log('FallbackSignalStrategy progress: ' + progress);
115 };
116
117 return new remoting.FallbackSignalStrategy(
118 new remoting.DnsBlackholeChecker(new remoting.XmppConnection()),
119 new remoting.WcsAdapter());
120 } else {
121 return new remoting.WcsAdapter();
122 }
123 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/server_log_entry.js ('k') | remoting/webapp/crd/js/smart_reconnector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698