OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
8 * | 8 * |
9 * This abstracts a <embed> element and controls the plugin which does the | 9 * This abstracts a <embed> element and controls the plugin which does the |
10 * actual remoting work. There should be no UI code inside this class. It | 10 * actual remoting work. There should be no UI code inside this class. It |
(...skipping 21 matching lines...) Expand all Loading... |
32 onStateChange) { | 32 onStateChange) { |
33 this.state = remoting.ClientSession.State.CREATED; | 33 this.state = remoting.ClientSession.State.CREATED; |
34 | 34 |
35 this.hostJid = hostJid; | 35 this.hostJid = hostJid; |
36 this.hostPublicKey = hostPublicKey; | 36 this.hostPublicKey = hostPublicKey; |
37 this.accessCode = accessCode; | 37 this.accessCode = accessCode; |
38 this.email = email; | 38 this.email = email; |
39 this.clientJid = ''; | 39 this.clientJid = ''; |
40 this.sessionId = ''; | 40 this.sessionId = ''; |
41 /** @type {remoting.ViewerPlugin} */ this.plugin = null; | 41 /** @type {remoting.ViewerPlugin} */ this.plugin = null; |
42 | 42 this.logToServer = new remoting.LogToServer(); |
43 this.onStateChange = onStateChange; | 43 this.onStateChange = onStateChange; |
44 }; | 44 }; |
45 | 45 |
46 /** @enum {number} */ | 46 /** @enum {number} */ |
47 remoting.ClientSession.State = { | 47 remoting.ClientSession.State = { |
48 UNKNOWN: 0, | 48 UNKNOWN: 0, |
49 CREATED: 1, | 49 CREATED: 1, |
50 BAD_PLUGIN_VERSION: 2, | 50 BAD_PLUGIN_VERSION: 2, |
51 UNKNOWN_PLUGIN_ERROR: 3, | 51 UNKNOWN_PLUGIN_ERROR: 3, |
52 CONNECTING: 4, | 52 CONNECTING: 4, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 * @private | 319 * @private |
320 * @param {remoting.ClientSession.State} state The new state for the session. | 320 * @param {remoting.ClientSession.State} state The new state for the session. |
321 * @return {void} Nothing. | 321 * @return {void} Nothing. |
322 */ | 322 */ |
323 remoting.ClientSession.prototype.setState_ = function(state) { | 323 remoting.ClientSession.prototype.setState_ = function(state) { |
324 var oldState = this.state; | 324 var oldState = this.state; |
325 this.state = state; | 325 this.state = state; |
326 if (this.onStateChange) { | 326 if (this.onStateChange) { |
327 this.onStateChange(oldState); | 327 this.onStateChange(oldState); |
328 } | 328 } |
| 329 this.logToServer.logClientSessionStateChange(this.state, this.error); |
329 }; | 330 }; |
330 | 331 |
331 /** | 332 /** |
332 * This is a callback that gets called when the window is resized. | 333 * This is a callback that gets called when the window is resized. |
333 * | 334 * |
334 * @return {void} Nothing. | 335 * @return {void} Nothing. |
335 */ | 336 */ |
336 remoting.ClientSession.prototype.onWindowSizeChanged = function() { | 337 remoting.ClientSession.prototype.onWindowSizeChanged = function() { |
337 remoting.debug.log('window size changed: ' + | 338 remoting.debug.log('window size changed: ' + |
338 window.innerWidth + 'x' + | 339 window.innerWidth + 'x' + |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 return { | 408 return { |
408 'video_bandwidth': this.plugin.videoBandwidth, | 409 'video_bandwidth': this.plugin.videoBandwidth, |
409 'video_frame_rate': this.plugin.videoFrameRate, | 410 'video_frame_rate': this.plugin.videoFrameRate, |
410 'capture_latency': this.plugin.videoCaptureLatency, | 411 'capture_latency': this.plugin.videoCaptureLatency, |
411 'encode_latency': this.plugin.videoEncodeLatency, | 412 'encode_latency': this.plugin.videoEncodeLatency, |
412 'decode_latency': this.plugin.videoDecodeLatency, | 413 'decode_latency': this.plugin.videoDecodeLatency, |
413 'render_latency': this.plugin.videoRenderLatency, | 414 'render_latency': this.plugin.videoRenderLatency, |
414 'roundtrip_latency': this.plugin.roundTripLatency | 415 'roundtrip_latency': this.plugin.roundTripLatency |
415 }; | 416 }; |
416 }; | 417 }; |
OLD | NEW |