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

Side by Side Diff: remoting/webapp/client_session.js

Issue 386853002: Add a Record button to the web-app if the host supports video recording. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: function -> var Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/client_screen.js ('k') | remoting/webapp/html/window_frame.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 this.shrinkToFitButton_ = document.getElementById('screen-shrink-to-fit'); 169 this.shrinkToFitButton_ = document.getElementById('screen-shrink-to-fit');
170 /** @type {HTMLElement} @private */ 170 /** @type {HTMLElement} @private */
171 this.fullScreenButton_ = document.getElementById('toggle-full-screen'); 171 this.fullScreenButton_ = document.getElementById('toggle-full-screen');
172 172
173 /** @type {remoting.GnubbyAuthHandler} @private */ 173 /** @type {remoting.GnubbyAuthHandler} @private */
174 this.gnubbyAuthHandler_ = null; 174 this.gnubbyAuthHandler_ = null;
175 175
176 /** @type {remoting.CastExtensionHandler} @private */ 176 /** @type {remoting.CastExtensionHandler} @private */
177 this.castExtensionHandler_ = null; 177 this.castExtensionHandler_ = null;
178 178
179 /** @type {remoting.VideoFrameRecorder} @private */
180 this.videoFrameRecorder_ = null;
181
179 if (this.mode_ == remoting.ClientSession.Mode.IT2ME) { 182 if (this.mode_ == remoting.ClientSession.Mode.IT2ME) {
180 // Resize-to-client is not supported for IT2Me hosts. 183 // Resize-to-client is not supported for IT2Me hosts.
181 this.resizeToClientButton_.hidden = true; 184 this.resizeToClientButton_.hidden = true;
182 } else { 185 } else {
183 this.resizeToClientButton_.hidden = false; 186 this.resizeToClientButton_.hidden = false;
184 } 187 }
185 188
186 this.fullScreenButton_.addEventListener( 189 this.fullScreenButton_.addEventListener(
187 'click', this.callToggleFullScreen_, false); 190 'click', this.callToggleFullScreen_, false);
191
188 this.defineEvents(Object.keys(remoting.ClientSession.Events)); 192 this.defineEvents(Object.keys(remoting.ClientSession.Events));
189 }; 193 };
190 194
191 base.extend(remoting.ClientSession, base.EventSource); 195 base.extend(remoting.ClientSession, base.EventSource);
192 196
193 /** @enum {string} */ 197 /** @enum {string} */
194 remoting.ClientSession.Events = { 198 remoting.ClientSession.Events = {
195 stateChanged: 'stateChanged', 199 stateChanged: 'stateChanged',
196 videoChannelStateChanged: 'videoChannelStateChanged', 200 videoChannelStateChanged: 'videoChannelStateChanged',
197 bumpScrollStarted: 'bumpScrollStarted', 201 bumpScrollStarted: 'bumpScrollStarted',
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 } 1051 }
1048 1052
1049 this.capabilities_ = capabilities; 1053 this.capabilities_ = capabilities;
1050 if (this.hasCapability_( 1054 if (this.hasCapability_(
1051 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION)) { 1055 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION)) {
1052 var clientArea = this.getClientArea_(); 1056 var clientArea = this.getClientArea_();
1053 this.plugin_.notifyClientResolution(clientArea.width, 1057 this.plugin_.notifyClientResolution(clientArea.width,
1054 clientArea.height, 1058 clientArea.height,
1055 window.devicePixelRatio); 1059 window.devicePixelRatio);
1056 } 1060 }
1061 if (this.hasCapability_(
1062 remoting.ClientSession.Capability.VIDEO_RECORDER)) {
1063 this.videoFrameRecorder_ = new remoting.VideoFrameRecorder(this.plugin_);
1064 }
1057 }; 1065 };
1058 1066
1059 /** 1067 /**
1060 * @private 1068 * @private
1061 * @param {remoting.ClientSession.State} newState The new state for the session. 1069 * @param {remoting.ClientSession.State} newState The new state for the session.
1062 * @return {void} Nothing. 1070 * @return {void} Nothing.
1063 */ 1071 */
1064 remoting.ClientSession.prototype.setState_ = function(newState) { 1072 remoting.ClientSession.prototype.setState_ = function(newState) {
1065 var oldState = this.state_; 1073 var oldState = this.state_;
1066 this.state_ = newState; 1074 this.state_ = newState;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 * Create a CastExtensionHandler and inform the host that cast extension 1594 * Create a CastExtensionHandler and inform the host that cast extension
1587 * is supported. 1595 * is supported.
1588 * @private 1596 * @private
1589 */ 1597 */
1590 remoting.ClientSession.prototype.createCastExtensionHandler_ = function() { 1598 remoting.ClientSession.prototype.createCastExtensionHandler_ = function() {
1591 if (remoting.enableCast && this.mode_ == remoting.ClientSession.Mode.ME2ME) { 1599 if (remoting.enableCast && this.mode_ == remoting.ClientSession.Mode.ME2ME) {
1592 this.castExtensionHandler_ = new remoting.CastExtensionHandler(this); 1600 this.castExtensionHandler_ = new remoting.CastExtensionHandler(this);
1593 } 1601 }
1594 }; 1602 };
1595 1603
1604 /**
1605 * Returns true if the ClientSession can record video frames to a file.
1606 * @return {boolean}
1607 */
1608 remoting.ClientSession.prototype.canRecordVideo = function() {
1609 return !!this.videoFrameRecorder_;
1610 }
1611
1612 /**
1613 * Returns true if the ClientSession is currently recording video frames.
1614 * @return {boolean}
1615 */
1616 remoting.ClientSession.prototype.isRecordingVideo = function() {
1617 if (!this.videoFrameRecorder_) {
1618 return false;
1619 }
1620 return this.videoFrameRecorder_.isRecording();
1621 }
1622
1623 /**
1624 * Starts or stops recording of video frames.
1625 */
1626 remoting.ClientSession.prototype.startStopRecording = function() {
1627 if (this.videoFrameRecorder_) {
1628 this.videoFrameRecorder_.startStopRecording();
1629 }
1630 }
1631
1632 /**
1633 * Handles protocol extension messages.
1634 * @param {string} type Type of extension message.
1635 * @param {string} data Contents of the extension message.
1636 * @return {boolean} True if the message was recognized, false otherwise.
1637 */
1638 remoting.ClientSession.prototype.handleExtensionMessage =
1639 function(type, data) {
1640 if (this.videoFrameRecorder_) {
1641 return this.videoFrameRecorder_.handleMessage(type, data);
1642 }
1643 return false;
1644 }
OLDNEW
« no previous file with comments | « remoting/webapp/client_screen.js ('k') | remoting/webapp/html/window_frame.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698