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

Side by Side Diff: remoting/webapp/options_menu.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: Move code out into OptionsMenu and VideoFrameRecorder 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 the in-session options menu (or menus in the case of apps v1). 7 * Class handling the in-session options menu (or menus in the case of apps v1).
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * @param {Element} sendCtrlAltDel 16 * @param {Element} sendCtrlAltDel
17 * @param {Element} sendPrtScrn 17 * @param {Element} sendPrtScrn
18 * @param {Element} resizeToClient 18 * @param {Element} resizeToClient
19 * @param {Element} shrinkToFit 19 * @param {Element} shrinkToFit
20 * @param {Element} newConnection 20 * @param {Element} newConnection
21 * @param {Element?} fullscreen 21 * @param {Element?} fullscreen
Jamie 2014/08/19 00:48:56 Missing annotation for startStopRecording.
22 * @constructor 22 * @constructor
23 */ 23 */
24 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, 24 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn,
25 resizeToClient, shrinkToFit, 25 resizeToClient, shrinkToFit,
26 newConnection, fullscreen) { 26 newConnection, fullscreen,
27 startStopRecording) {
27 this.sendCtrlAltDel_ = sendCtrlAltDel; 28 this.sendCtrlAltDel_ = sendCtrlAltDel;
28 this.sendPrtScrn_ = sendPrtScrn; 29 this.sendPrtScrn_ = sendPrtScrn;
29 this.resizeToClient_ = resizeToClient; 30 this.resizeToClient_ = resizeToClient;
30 this.shrinkToFit_ = shrinkToFit; 31 this.shrinkToFit_ = shrinkToFit;
31 this.newConnection_ = newConnection; 32 this.newConnection_ = newConnection;
32 this.fullscreen_ = fullscreen; 33 this.fullscreen_ = fullscreen;
34 this.startStopRecording_ = startStopRecording;
33 /** 35 /**
34 * @type {remoting.ClientSession} 36 * @type {remoting.ClientSession}
35 * @private 37 * @private
36 */ 38 */
37 this.clientSession_ = null; 39 this.clientSession_ = null;
38 40
39 this.sendCtrlAltDel_.addEventListener( 41 this.sendCtrlAltDel_.addEventListener(
40 'click', this.onSendCtrlAltDel_.bind(this), false); 42 'click', this.onSendCtrlAltDel_.bind(this), false);
41 this.sendPrtScrn_.addEventListener( 43 this.sendPrtScrn_.addEventListener(
42 'click', this.onSendPrtScrn_.bind(this), false); 44 'click', this.onSendPrtScrn_.bind(this), false);
43 this.resizeToClient_.addEventListener( 45 this.resizeToClient_.addEventListener(
44 'click', this.onResizeToClient_.bind(this), false); 46 'click', this.onResizeToClient_.bind(this), false);
45 this.shrinkToFit_.addEventListener( 47 this.shrinkToFit_.addEventListener(
46 'click', this.onShrinkToFit_.bind(this), false); 48 'click', this.onShrinkToFit_.bind(this), false);
47 this.newConnection_.addEventListener( 49 this.newConnection_.addEventListener(
48 'click', this.onNewConnection_.bind(this), false); 50 'click', this.onNewConnection_.bind(this), false);
49 if (this.fullscreen_) { 51 if (this.fullscreen_) {
50 this.fullscreen_.addEventListener( 52 this.fullscreen_.addEventListener(
51 'click', this.onFullscreen_.bind(this), false); 53 'click', this.onFullscreen_.bind(this), false);
52 } 54 }
55 if (this.startStopRecording_) {
56 this.startStopRecording_.addEventListener(
57 'click', this.onStartStopRecording_.bind(this), false);
58 }
53 }; 59 };
54 60
55 /** 61 /**
56 * @param {remoting.ClientSession} clientSession The active session, or null if 62 * @param {remoting.ClientSession} clientSession The active session, or null if
57 * there is no connection. 63 * there is no connection.
58 */ 64 */
59 remoting.OptionsMenu.prototype.setClientSession = function(clientSession) { 65 remoting.OptionsMenu.prototype.setClientSession = function(clientSession) {
60 this.clientSession_ = clientSession; 66 this.clientSession_ = clientSession;
61 }; 67 };
62 68
63 remoting.OptionsMenu.prototype.onShow = function() { 69 remoting.OptionsMenu.prototype.onShow = function() {
64 if (this.clientSession_) { 70 if (this.clientSession_) {
65 remoting.MenuButton.select( 71 remoting.MenuButton.select(
66 this.resizeToClient_, this.clientSession_.getResizeToClient()); 72 this.resizeToClient_, this.clientSession_.getResizeToClient());
67 remoting.MenuButton.select( 73 remoting.MenuButton.select(
68 this.shrinkToFit_, this.clientSession_.getShrinkToFit()); 74 this.shrinkToFit_, this.clientSession_.getShrinkToFit());
69 if (this.fullscreen_) { 75 if (this.fullscreen_) {
70 remoting.MenuButton.select( 76 remoting.MenuButton.select(
71 this.fullscreen_, remoting.fullscreen.isActive()); 77 this.fullscreen_, remoting.fullscreen.isActive());
72 } 78 }
79 if (this.startStopRecording_) {
80 this.startStopRecording_.hidden = !this.clientSession_.canRecordVideo();
81 }
73 } 82 }
74 }; 83 };
75 84
76 remoting.OptionsMenu.prototype.onSendCtrlAltDel_ = function() { 85 remoting.OptionsMenu.prototype.onSendCtrlAltDel_ = function() {
77 if (this.clientSession_) { 86 if (this.clientSession_) {
78 this.clientSession_.sendCtrlAltDel(); 87 this.clientSession_.sendCtrlAltDel();
79 } 88 }
80 }; 89 };
81 90
82 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() { 91 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() {
(...skipping 20 matching lines...) Expand all
103 chrome.app.window.create('main.html', { 112 chrome.app.window.create('main.html', {
104 'width': 800, 113 'width': 800,
105 'height': 600, 114 'height': 600,
106 'frame': 'none' 115 'frame': 'none'
107 }); 116 });
108 }; 117 };
109 118
110 remoting.OptionsMenu.prototype.onFullscreen_ = function() { 119 remoting.OptionsMenu.prototype.onFullscreen_ = function() {
111 remoting.fullscreen.toggle(); 120 remoting.fullscreen.toggle();
112 }; 121 };
122
123 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() {
124 if (this.clientSession_) {
125 this.clientSession_.startStopRecording();
126 }
127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698