OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 user-facing aspects of the client session. | 7 * Class handling user-facing aspects of the client session. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 /** private {remoting.ConnectedView} */ | 39 /** private {remoting.ConnectedView} */ |
40 this.view_ = null; | 40 this.view_ = null; |
41 | 41 |
42 /** @private {remoting.VideoFrameRecorder} */ | 42 /** @private {remoting.VideoFrameRecorder} */ |
43 this.videoFrameRecorder_ = null; | 43 this.videoFrameRecorder_ = null; |
44 | 44 |
45 /** private {base.Disposable} */ | 45 /** private {base.Disposable} */ |
46 this.eventHooks_ = null; | 46 this.eventHooks_ = null; |
47 | 47 |
| 48 /** @private */ |
| 49 this.stats_ = new remoting.ConnectionStats( |
| 50 document.getElementById('statistics'), connectionInfo.plugin()); |
| 51 |
48 this.initPlugin_(); | 52 this.initPlugin_(); |
49 this.initUI_(); | 53 this.initUI_(); |
50 }; | 54 }; |
51 | 55 |
52 /** @return {void} Nothing. */ | 56 /** @return {void} Nothing. */ |
53 remoting.DesktopConnectedView.prototype.dispose = function() { | 57 remoting.DesktopConnectedView.prototype.dispose = function() { |
54 if (remoting.windowFrame) { | 58 if (remoting.windowFrame) { |
55 remoting.windowFrame.setDesktopConnectedView(null); | 59 remoting.windowFrame.setDesktopConnectedView(null); |
56 } | 60 } |
57 if (remoting.toolbar) { | 61 if (remoting.toolbar) { |
58 remoting.toolbar.setDesktopConnectedView(null); | 62 remoting.toolbar.setDesktopConnectedView(null); |
59 } | 63 } |
60 if (remoting.optionsMenu) { | 64 if (remoting.optionsMenu) { |
61 remoting.optionsMenu.setDesktopConnectedView(null); | 65 remoting.optionsMenu.setDesktopConnectedView(null); |
62 } | 66 } |
63 | 67 |
64 document.body.classList.remove('connected'); | 68 document.body.classList.remove('connected'); |
65 | 69 |
66 base.dispose(this.eventHooks_); | 70 base.dispose(this.eventHooks_); |
67 this.eventHooks_ = null; | 71 this.eventHooks_ = null; |
68 | 72 |
69 base.dispose(this.viewport_); | 73 base.dispose(this.viewport_); |
70 this.viewport_ = null; | 74 this.viewport_ = null; |
| 75 |
| 76 base.dispose(this.stats_); |
| 77 this.stats = null; |
71 }; | 78 }; |
72 | 79 |
73 /** | 80 /** |
74 * Get host display name. | 81 * Get host display name. |
75 * | 82 * |
76 * @return {string} | 83 * @return {string} |
77 */ | 84 */ |
78 remoting.DesktopConnectedView.prototype.getHostDisplayName = function() { | 85 remoting.DesktopConnectedView.prototype.getHostDisplayName = function() { |
79 return this.host_.hostName; | 86 return this.host_.hostName; |
80 }; | 87 }; |
(...skipping 11 matching lines...) Expand all Loading... |
92 /** | 99 /** |
93 * @return {boolean} True if resize-to-client is enabled; false otherwise. | 100 * @return {boolean} True if resize-to-client is enabled; false otherwise. |
94 */ | 101 */ |
95 remoting.DesktopConnectedView.prototype.getResizeToClient = function() { | 102 remoting.DesktopConnectedView.prototype.getResizeToClient = function() { |
96 if (this.viewport_) { | 103 if (this.viewport_) { |
97 return this.viewport_.getResizeToClient(); | 104 return this.viewport_.getResizeToClient(); |
98 } | 105 } |
99 return false; | 106 return false; |
100 }; | 107 }; |
101 | 108 |
| 109 remoting.DesktopConnectedView.prototype.toggleStats = function() { |
| 110 this.stats_.toggle(); |
| 111 }; |
| 112 |
| 113 /** |
| 114 * @return {boolean} True if the connection stats is visible; false otherwise. |
| 115 */ |
| 116 remoting.DesktopConnectedView.prototype.isStatsVisible = function() { |
| 117 return this.stats_.isVisible(); |
| 118 }; |
| 119 |
102 /** | 120 /** |
103 * @return {Element} The element that should host the plugin. | 121 * @return {Element} The element that should host the plugin. |
104 * @private | 122 * @private |
105 */ | 123 */ |
106 remoting.DesktopConnectedView.prototype.getPluginContainer_ = function() { | 124 remoting.DesktopConnectedView.prototype.getPluginContainer_ = function() { |
107 return this.container_.querySelector('.client-plugin-container'); | 125 return this.container_.querySelector('.client-plugin-container'); |
108 }; | 126 }; |
109 | 127 |
110 /** @return {remoting.DesktopViewport} */ | 128 /** @return {remoting.DesktopViewport} */ |
111 remoting.DesktopConnectedView.prototype.getViewportForTesting = function() { | 129 remoting.DesktopConnectedView.prototype.getViewportForTesting = function() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 }; | 278 }; |
261 | 279 |
262 /** | 280 /** |
263 * Starts or stops recording of video frames. | 281 * Starts or stops recording of video frames. |
264 */ | 282 */ |
265 remoting.DesktopConnectedView.prototype.startStopRecording = function() { | 283 remoting.DesktopConnectedView.prototype.startStopRecording = function() { |
266 if (this.videoFrameRecorder_) { | 284 if (this.videoFrameRecorder_) { |
267 this.videoFrameRecorder_.startStopRecording(); | 285 this.videoFrameRecorder_.startStopRecording(); |
268 } | 286 } |
269 }; | 287 }; |
OLD | NEW |