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

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: 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/manifest.json.jinja2 ('k') | remoting/webapp/toolbar.js » ('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 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
22 * @param {Element?} startStopRecording
22 * @constructor 23 * @constructor
23 */ 24 */
24 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, 25 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn,
25 resizeToClient, shrinkToFit, 26 resizeToClient, shrinkToFit,
26 newConnection, fullscreen) { 27 newConnection, fullscreen,
28 startStopRecording) {
27 this.sendCtrlAltDel_ = sendCtrlAltDel; 29 this.sendCtrlAltDel_ = sendCtrlAltDel;
28 this.sendPrtScrn_ = sendPrtScrn; 30 this.sendPrtScrn_ = sendPrtScrn;
29 this.resizeToClient_ = resizeToClient; 31 this.resizeToClient_ = resizeToClient;
30 this.shrinkToFit_ = shrinkToFit; 32 this.shrinkToFit_ = shrinkToFit;
31 this.newConnection_ = newConnection; 33 this.newConnection_ = newConnection;
32 this.fullscreen_ = fullscreen; 34 this.fullscreen_ = fullscreen;
35 this.startStopRecording_ = startStopRecording;
33 /** 36 /**
34 * @type {remoting.ClientSession} 37 * @type {remoting.ClientSession}
35 * @private 38 * @private
36 */ 39 */
37 this.clientSession_ = null; 40 this.clientSession_ = null;
38 41
39 this.sendCtrlAltDel_.addEventListener( 42 this.sendCtrlAltDel_.addEventListener(
40 'click', this.onSendCtrlAltDel_.bind(this), false); 43 'click', this.onSendCtrlAltDel_.bind(this), false);
41 this.sendPrtScrn_.addEventListener( 44 this.sendPrtScrn_.addEventListener(
42 'click', this.onSendPrtScrn_.bind(this), false); 45 'click', this.onSendPrtScrn_.bind(this), false);
43 this.resizeToClient_.addEventListener( 46 this.resizeToClient_.addEventListener(
44 'click', this.onResizeToClient_.bind(this), false); 47 'click', this.onResizeToClient_.bind(this), false);
45 this.shrinkToFit_.addEventListener( 48 this.shrinkToFit_.addEventListener(
46 'click', this.onShrinkToFit_.bind(this), false); 49 'click', this.onShrinkToFit_.bind(this), false);
47 this.newConnection_.addEventListener( 50 this.newConnection_.addEventListener(
48 'click', this.onNewConnection_.bind(this), false); 51 'click', this.onNewConnection_.bind(this), false);
49 if (this.fullscreen_) { 52 if (this.fullscreen_) {
50 this.fullscreen_.addEventListener( 53 this.fullscreen_.addEventListener(
51 'click', this.onFullscreen_.bind(this), false); 54 'click', this.onFullscreen_.bind(this), false);
52 } 55 }
56 if (this.startStopRecording_) {
57 this.startStopRecording_.addEventListener(
58 'click', this.onStartStopRecording_.bind(this), false);
59 }
53 }; 60 };
54 61
55 /** 62 /**
56 * @param {remoting.ClientSession} clientSession The active session, or null if 63 * @param {remoting.ClientSession} clientSession The active session, or null if
57 * there is no connection. 64 * there is no connection.
58 */ 65 */
59 remoting.OptionsMenu.prototype.setClientSession = function(clientSession) { 66 remoting.OptionsMenu.prototype.setClientSession = function(clientSession) {
60 this.clientSession_ = clientSession; 67 this.clientSession_ = clientSession;
61 }; 68 };
62 69
63 remoting.OptionsMenu.prototype.onShow = function() { 70 remoting.OptionsMenu.prototype.onShow = function() {
64 if (this.clientSession_) { 71 if (this.clientSession_) {
65 remoting.MenuButton.select( 72 remoting.MenuButton.select(
66 this.resizeToClient_, this.clientSession_.getResizeToClient()); 73 this.resizeToClient_, this.clientSession_.getResizeToClient());
67 remoting.MenuButton.select( 74 remoting.MenuButton.select(
68 this.shrinkToFit_, this.clientSession_.getShrinkToFit()); 75 this.shrinkToFit_, this.clientSession_.getShrinkToFit());
69 if (this.fullscreen_) { 76 if (this.fullscreen_) {
70 remoting.MenuButton.select( 77 remoting.MenuButton.select(
71 this.fullscreen_, remoting.fullscreen.isActive()); 78 this.fullscreen_, remoting.fullscreen.isActive());
72 } 79 }
80 if (this.startStopRecording_) {
81 this.startStopRecording_.hidden = !this.clientSession_.canRecordVideo();
82 if (this.clientSession_.isRecordingVideo()) {
83 l10n.localizeElementFromTag(this.startStopRecording_,
84 /*i18n-content*/'STOP_RECORDING');
85 } else {
86 l10n.localizeElementFromTag(this.startStopRecording_,
87 /*i18n-content*/'START_RECORDING');
88 }
89 }
73 } 90 }
74 }; 91 };
75 92
76 remoting.OptionsMenu.prototype.onSendCtrlAltDel_ = function() { 93 remoting.OptionsMenu.prototype.onSendCtrlAltDel_ = function() {
77 if (this.clientSession_) { 94 if (this.clientSession_) {
78 this.clientSession_.sendCtrlAltDel(); 95 this.clientSession_.sendCtrlAltDel();
79 } 96 }
80 }; 97 };
81 98
82 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() { 99 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() {
(...skipping 20 matching lines...) Expand all
103 chrome.app.window.create('main.html', { 120 chrome.app.window.create('main.html', {
104 'width': 800, 121 'width': 800,
105 'height': 600, 122 'height': 600,
106 'frame': 'none' 123 'frame': 'none'
107 }); 124 });
108 }; 125 };
109 126
110 remoting.OptionsMenu.prototype.onFullscreen_ = function() { 127 remoting.OptionsMenu.prototype.onFullscreen_ = function() {
111 remoting.fullscreen.toggle(); 128 remoting.fullscreen.toggle();
112 }; 129 };
130
131 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() {
132 if (this.clientSession_) {
133 this.clientSession_.startStopRecording();
134 }
135 }
OLDNEW
« no previous file with comments | « remoting/webapp/manifest.json.jinja2 ('k') | remoting/webapp/toolbar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698