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

Side by Side Diff: remoting/webapp/crd/js/options_menu.js

Issue 1089493002: [Webapp Refactor] Re-add remoting.ConnectionStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 years, 8 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
« no previous file with comments | « remoting/webapp/crd/js/desktop_connected_view.js ('k') | remoting/webapp/crd/js/remoting.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?} toggleStats
22 * @param {Element?} startStopRecording 23 * @param {Element?} startStopRecording
23 * @constructor 24 * @constructor
24 */ 25 */
25 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, 26 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn,
26 resizeToClient, shrinkToFit, 27 resizeToClient, shrinkToFit,
27 newConnection, fullscreen, 28 newConnection, fullscreen, toggleStats,
28 startStopRecording) { 29 startStopRecording) {
29 this.sendCtrlAltDel_ = sendCtrlAltDel; 30 this.sendCtrlAltDel_ = sendCtrlAltDel;
30 this.sendPrtScrn_ = sendPrtScrn; 31 this.sendPrtScrn_ = sendPrtScrn;
31 this.resizeToClient_ = resizeToClient; 32 this.resizeToClient_ = resizeToClient;
32 this.shrinkToFit_ = shrinkToFit; 33 this.shrinkToFit_ = shrinkToFit;
33 this.newConnection_ = newConnection; 34 this.newConnection_ = newConnection;
34 this.fullscreen_ = fullscreen; 35 this.fullscreen_ = fullscreen;
36 this.toggleStats_ = toggleStats;
35 this.startStopRecording_ = startStopRecording; 37 this.startStopRecording_ = startStopRecording;
36 38
37 /** @private {remoting.DesktopConnectedView} */ 39 /** @private {remoting.DesktopConnectedView} */
38 this.desktopConnectedView_ = null; 40 this.desktopConnectedView_ = null;
39 41
40 this.sendCtrlAltDel_.addEventListener( 42 this.sendCtrlAltDel_.addEventListener(
41 'click', this.onSendCtrlAltDel_.bind(this), false); 43 'click', this.onSendCtrlAltDel_.bind(this), false);
42 this.sendPrtScrn_.addEventListener( 44 this.sendPrtScrn_.addEventListener(
43 'click', this.onSendPrtScrn_.bind(this), false); 45 'click', this.onSendPrtScrn_.bind(this), false);
44 this.resizeToClient_.addEventListener( 46 this.resizeToClient_.addEventListener(
45 'click', this.onResizeToClient_.bind(this), false); 47 'click', this.onResizeToClient_.bind(this), false);
46 this.shrinkToFit_.addEventListener( 48 this.shrinkToFit_.addEventListener(
47 'click', this.onShrinkToFit_.bind(this), false); 49 'click', this.onShrinkToFit_.bind(this), false);
48 this.newConnection_.addEventListener( 50 this.newConnection_.addEventListener(
49 'click', this.onNewConnection_.bind(this), false); 51 'click', this.onNewConnection_.bind(this), false);
52
50 if (this.fullscreen_) { 53 if (this.fullscreen_) {
51 this.fullscreen_.addEventListener( 54 fullscreen.addEventListener('click', this.onFullscreen_.bind(this), false);
52 'click', this.onFullscreen_.bind(this), false); 55 }
56 if (this.toggleStats_) {
57 toggleStats.addEventListener(
58 'click', this.onToggleStats_.bind(this), false);
53 } 59 }
54 if (this.startStopRecording_) { 60 if (this.startStopRecording_) {
55 this.startStopRecording_.addEventListener( 61 this.startStopRecording_.addEventListener(
56 'click', this.onStartStopRecording_.bind(this), false); 62 'click', this.onStartStopRecording_.bind(this), false);
57 } 63 }
58 }; 64 };
59 65
60 /** 66 /**
61 * @param {remoting.DesktopConnectedView} desktopConnectedView The view for the 67 * @param {remoting.DesktopConnectedView} desktopConnectedView The view for the
62 * active session, or null if there is no connection. 68 * active session, or null if there is no connection.
63 */ 69 */
64 remoting.OptionsMenu.prototype.setDesktopConnectedView = function( 70 remoting.OptionsMenu.prototype.setDesktopConnectedView = function(
65 desktopConnectedView) { 71 desktopConnectedView) {
66 this.desktopConnectedView_ = desktopConnectedView; 72 this.desktopConnectedView_ = desktopConnectedView;
67 }; 73 };
68 74
69 remoting.OptionsMenu.prototype.onShow = function() { 75 remoting.OptionsMenu.prototype.onShow = function() {
70 if (this.desktopConnectedView_) { 76 if (this.desktopConnectedView_) {
71 this.resizeToClient_.hidden = 77 this.resizeToClient_.hidden =
72 remoting.app.getConnectionMode() === remoting.Application.Mode.IT2ME; 78 remoting.app.getConnectionMode() === remoting.Application.Mode.IT2ME;
73 remoting.MenuButton.select( 79 remoting.MenuButton.select(
74 this.resizeToClient_, this.desktopConnectedView_.getResizeToClient()); 80 this.resizeToClient_, this.desktopConnectedView_.getResizeToClient());
75 remoting.MenuButton.select( 81 remoting.MenuButton.select(
76 this.shrinkToFit_, this.desktopConnectedView_.getShrinkToFit()); 82 this.shrinkToFit_, this.desktopConnectedView_.getShrinkToFit());
83
77 if (this.fullscreen_) { 84 if (this.fullscreen_) {
78 remoting.MenuButton.select( 85 remoting.MenuButton.select(
79 this.fullscreen_, remoting.fullscreen.isActive()); 86 this.fullscreen_, remoting.fullscreen.isActive());
80 } 87 }
88 if (this.toggleStats_) {
89 remoting.MenuButton.select(
90 this.toggleStats_, this.desktopConnectedView_.isStatsVisible());
91 }
81 if (this.startStopRecording_) { 92 if (this.startStopRecording_) {
82 this.startStopRecording_.hidden = 93 this.startStopRecording_.hidden =
83 !this.desktopConnectedView_.canRecordVideo(); 94 !this.desktopConnectedView_.canRecordVideo();
84 if (this.desktopConnectedView_.isRecordingVideo()) { 95 if (this.desktopConnectedView_.isRecordingVideo()) {
85 l10n.localizeElementFromTag(this.startStopRecording_, 96 l10n.localizeElementFromTag(this.startStopRecording_,
86 /*i18n-content*/'STOP_RECORDING'); 97 /*i18n-content*/'STOP_RECORDING');
87 } else { 98 } else {
88 l10n.localizeElementFromTag(this.startStopRecording_, 99 l10n.localizeElementFromTag(this.startStopRecording_,
89 /*i18n-content*/'START_RECORDING'); 100 /*i18n-content*/'START_RECORDING');
90 } 101 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 'width': 800, 136 'width': 800,
126 'height': 600, 137 'height': 600,
127 'frame': 'none' 138 'frame': 'none'
128 }); 139 });
129 }; 140 };
130 141
131 remoting.OptionsMenu.prototype.onFullscreen_ = function() { 142 remoting.OptionsMenu.prototype.onFullscreen_ = function() {
132 remoting.fullscreen.toggle(); 143 remoting.fullscreen.toggle();
133 }; 144 };
134 145
146 remoting.OptionsMenu.prototype.onToggleStats_ = function() {
147 if (this.desktopConnectedView_) {
148 this.desktopConnectedView_.toggleStats();
149 }
150 };
151
135 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() { 152 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() {
136 if (this.desktopConnectedView_) { 153 if (this.desktopConnectedView_) {
137 this.desktopConnectedView_.startStopRecording(); 154 this.desktopConnectedView_.startStopRecording();
138 } 155 }
139 } 156 };
140 157
141 /** 158 /**
142 * @type {remoting.OptionsMenu} 159 * @type {remoting.OptionsMenu}
143 */ 160 */
144 remoting.optionsMenu = null; 161 remoting.optionsMenu = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/desktop_connected_view.js ('k') | remoting/webapp/crd/js/remoting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698