OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 img.style.left = event.x + 'px'; | 155 img.style.left = event.x + 'px'; |
156 }; | 156 }; |
157 | 157 |
158 /** @type {HTMLElement} @private */ | 158 /** @type {HTMLElement} @private */ |
159 this.resizeToClientButton_ = | 159 this.resizeToClientButton_ = |
160 document.getElementById('screen-resize-to-client'); | 160 document.getElementById('screen-resize-to-client'); |
161 /** @type {HTMLElement} @private */ | 161 /** @type {HTMLElement} @private */ |
162 this.shrinkToFitButton_ = document.getElementById('screen-shrink-to-fit'); | 162 this.shrinkToFitButton_ = document.getElementById('screen-shrink-to-fit'); |
163 /** @type {HTMLElement} @private */ | 163 /** @type {HTMLElement} @private */ |
164 this.fullScreenButton_ = document.getElementById('toggle-full-screen'); | 164 this.fullScreenButton_ = document.getElementById('toggle-full-screen'); |
165 /** @type {HTMLElement} @private */ | |
166 this.recordingButton_ = document.getElementById('start-stop-recording'); | |
165 | 167 |
166 /** @type {remoting.GnubbyAuthHandler} @private */ | 168 /** @type {remoting.GnubbyAuthHandler} @private */ |
167 this.gnubbyAuthHandler_ = null; | 169 this.gnubbyAuthHandler_ = null; |
168 | 170 |
171 /** @type {remoting.VideoFrameRecorder} @private */ | |
172 this.videoFrameRecorder_ = null; | |
173 | |
169 if (this.mode_ == remoting.ClientSession.Mode.IT2ME) { | 174 if (this.mode_ == remoting.ClientSession.Mode.IT2ME) { |
170 // Resize-to-client is not supported for IT2Me hosts. | 175 // Resize-to-client is not supported for IT2Me hosts. |
171 this.resizeToClientButton_.hidden = true; | 176 this.resizeToClientButton_.hidden = true; |
172 } else { | 177 } else { |
173 this.resizeToClientButton_.hidden = false; | 178 this.resizeToClientButton_.hidden = false; |
174 } | 179 } |
175 | 180 |
176 this.fullScreenButton_.addEventListener( | 181 this.fullScreenButton_.addEventListener( |
177 'click', this.callToggleFullScreen_, false); | 182 'click', this.callToggleFullScreen_, false); |
183 | |
178 this.defineEvents(Object.keys(remoting.ClientSession.Events)); | 184 this.defineEvents(Object.keys(remoting.ClientSession.Events)); |
179 }; | 185 }; |
180 | 186 |
181 base.extend(remoting.ClientSession, base.EventSource); | 187 base.extend(remoting.ClientSession, base.EventSource); |
182 | 188 |
183 /** @enum {string} */ | 189 /** @enum {string} */ |
184 remoting.ClientSession.Events = { | 190 remoting.ClientSession.Events = { |
185 stateChanged: 'stateChanged', | 191 stateChanged: 'stateChanged', |
186 videoChannelStateChanged: 'videoChannelStateChanged', | 192 videoChannelStateChanged: 'videoChannelStateChanged', |
187 bumpScrollStarted: 'bumpScrollStarted', | 193 bumpScrollStarted: 'bumpScrollStarted', |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1073 } | 1079 } |
1074 | 1080 |
1075 this.capabilities_ = capabilities; | 1081 this.capabilities_ = capabilities; |
1076 if (this.hasCapability_( | 1082 if (this.hasCapability_( |
1077 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION)) { | 1083 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION)) { |
1078 var clientArea = this.getClientArea_(); | 1084 var clientArea = this.getClientArea_(); |
1079 this.plugin_.notifyClientResolution(clientArea.width, | 1085 this.plugin_.notifyClientResolution(clientArea.width, |
1080 clientArea.height, | 1086 clientArea.height, |
1081 window.devicePixelRatio); | 1087 window.devicePixelRatio); |
1082 } | 1088 } |
1089 if (this.hasCapability_( | |
1090 remoting.ClientSession.Capability.VIDEO_RECORDER)) { | |
1091 this.videoFrameRecorder_ = new remoting.VideoFrameRecorder(); | |
kelvinp
2014/08/15 23:37:31
This change looks pretty cool. Are we shipping thi
Sergey Ulanov
2014/08/16 00:16:58
This feature is disabled in the host by default an
| |
1092 this.recordingButton_.hidden = false; | |
1093 this.recordingButton_.addEventListener( | |
1094 'click', this.videoFrameRecorder_.startStopRecording.bind(this), false); | |
1095 } | |
1083 }; | 1096 }; |
1084 | 1097 |
1085 /** | 1098 /** |
1086 * @private | 1099 * @private |
1087 * @param {remoting.ClientSession.State} newState The new state for the session. | 1100 * @param {remoting.ClientSession.State} newState The new state for the session. |
1088 * @return {void} Nothing. | 1101 * @return {void} Nothing. |
1089 */ | 1102 */ |
1090 remoting.ClientSession.prototype.setState_ = function(newState) { | 1103 remoting.ClientSession.prototype.setState_ = function(newState) { |
1091 var oldState = this.state_; | 1104 var oldState = this.state_; |
1092 this.state_ = newState; | 1105 this.state_ = newState; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1571 * @return {{top: number, left:number}} The top-left corner of the plugin. | 1584 * @return {{top: number, left:number}} The top-left corner of the plugin. |
1572 */ | 1585 */ |
1573 remoting.ClientSession.prototype.getPluginPositionForTesting = function() { | 1586 remoting.ClientSession.prototype.getPluginPositionForTesting = function() { |
1574 var plugin = this.plugin_.element(); | 1587 var plugin = this.plugin_.element(); |
1575 var style = plugin.style; | 1588 var style = plugin.style; |
1576 return { | 1589 return { |
1577 top: parseFloat(style.marginTop), | 1590 top: parseFloat(style.marginTop), |
1578 left: parseFloat(style.marginLeft) | 1591 left: parseFloat(style.marginLeft) |
1579 }; | 1592 }; |
1580 }; | 1593 }; |
1594 | |
1595 /** | |
1596 * | |
1597 */ | |
1598 remoting.ClientSession.prototype.handleExtensionMessage = | |
1599 function(type, data) { | |
1600 if (this.videoFrameRecorder_) { | |
1601 return this.videoFrameRecorder_.handleMessage(type, data); | |
1602 } | |
1603 return false; | |
1604 } | |
OLD | NEW |