OLD | NEW |
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} mapRightCtrl |
18 * @param {Element} resizeToClient | 19 * @param {Element} resizeToClient |
19 * @param {Element} shrinkToFit | 20 * @param {Element} shrinkToFit |
20 * @param {Element} newConnection | 21 * @param {Element} newConnection |
21 * @param {Element?} fullscreen | 22 * @param {Element?} fullscreen |
22 * @param {Element?} toggleStats | 23 * @param {Element?} toggleStats |
23 * @param {Element?} startStopRecording | 24 * @param {Element?} startStopRecording |
24 * @constructor | 25 * @constructor |
25 */ | 26 */ |
26 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, | 27 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, mapRightCtrl, |
27 resizeToClient, shrinkToFit, | 28 resizeToClient, shrinkToFit, |
28 newConnection, fullscreen, toggleStats, | 29 newConnection, fullscreen, toggleStats, |
29 startStopRecording) { | 30 startStopRecording) { |
30 this.sendCtrlAltDel_ = sendCtrlAltDel; | 31 this.sendCtrlAltDel_ = sendCtrlAltDel; |
31 this.sendPrtScrn_ = sendPrtScrn; | 32 this.sendPrtScrn_ = sendPrtScrn; |
| 33 this.mapRightCtrl_ = mapRightCtrl; |
32 this.resizeToClient_ = resizeToClient; | 34 this.resizeToClient_ = resizeToClient; |
33 this.shrinkToFit_ = shrinkToFit; | 35 this.shrinkToFit_ = shrinkToFit; |
34 this.newConnection_ = newConnection; | 36 this.newConnection_ = newConnection; |
35 this.fullscreen_ = fullscreen; | 37 this.fullscreen_ = fullscreen; |
36 this.toggleStats_ = toggleStats; | 38 this.toggleStats_ = toggleStats; |
37 this.startStopRecording_ = startStopRecording; | 39 this.startStopRecording_ = startStopRecording; |
38 | 40 |
39 /** @private {remoting.DesktopConnectedView} */ | 41 /** @private {remoting.DesktopConnectedView} */ |
40 this.desktopConnectedView_ = null; | 42 this.desktopConnectedView_ = null; |
41 | 43 |
42 this.sendCtrlAltDel_.addEventListener( | 44 this.sendCtrlAltDel_.addEventListener( |
43 'click', this.onSendCtrlAltDel_.bind(this), false); | 45 'click', this.onSendCtrlAltDel_.bind(this), false); |
44 this.sendPrtScrn_.addEventListener( | 46 this.sendPrtScrn_.addEventListener( |
45 'click', this.onSendPrtScrn_.bind(this), false); | 47 'click', this.onSendPrtScrn_.bind(this), false); |
| 48 this.mapRightCtrl_.addEventListener( |
| 49 'click', this.onMapRightCtrl_.bind(this), false); |
46 this.resizeToClient_.addEventListener( | 50 this.resizeToClient_.addEventListener( |
47 'click', this.onResizeToClient_.bind(this), false); | 51 'click', this.onResizeToClient_.bind(this), false); |
48 this.shrinkToFit_.addEventListener( | 52 this.shrinkToFit_.addEventListener( |
49 'click', this.onShrinkToFit_.bind(this), false); | 53 'click', this.onShrinkToFit_.bind(this), false); |
50 this.newConnection_.addEventListener( | 54 this.newConnection_.addEventListener( |
51 'click', this.onNewConnection_.bind(this), false); | 55 'click', this.onNewConnection_.bind(this), false); |
52 | 56 |
53 if (this.fullscreen_) { | 57 if (this.fullscreen_) { |
54 fullscreen.addEventListener('click', this.onFullscreen_.bind(this), false); | 58 fullscreen.addEventListener('click', this.onFullscreen_.bind(this), false); |
55 } | 59 } |
(...skipping 15 matching lines...) Expand all Loading... |
71 desktopConnectedView) { | 75 desktopConnectedView) { |
72 this.desktopConnectedView_ = desktopConnectedView; | 76 this.desktopConnectedView_ = desktopConnectedView; |
73 }; | 77 }; |
74 | 78 |
75 remoting.OptionsMenu.prototype.onShow = function() { | 79 remoting.OptionsMenu.prototype.onShow = function() { |
76 if (this.desktopConnectedView_) { | 80 if (this.desktopConnectedView_) { |
77 base.debug.assert(remoting.app instanceof remoting.DesktopRemoting); | 81 base.debug.assert(remoting.app instanceof remoting.DesktopRemoting); |
78 var drApp = /** @type {remoting.DesktopRemoting} */ (remoting.app); | 82 var drApp = /** @type {remoting.DesktopRemoting} */ (remoting.app); |
79 var mode = drApp.getConnectionMode(); | 83 var mode = drApp.getConnectionMode(); |
80 | 84 |
| 85 this.mapRightCtrl_.hidden = !remoting.platformIsChromeOS(); |
| 86 remoting.MenuButton.select( |
| 87 this.mapRightCtrl_, this.desktopConnectedView_.getMapRightCtrl()); |
| 88 |
81 this.resizeToClient_.hidden = mode === remoting.DesktopRemoting.Mode.IT2ME; | 89 this.resizeToClient_.hidden = mode === remoting.DesktopRemoting.Mode.IT2ME; |
82 remoting.MenuButton.select( | 90 remoting.MenuButton.select( |
83 this.resizeToClient_, this.desktopConnectedView_.getResizeToClient()); | 91 this.resizeToClient_, this.desktopConnectedView_.getResizeToClient()); |
84 remoting.MenuButton.select( | 92 remoting.MenuButton.select( |
85 this.shrinkToFit_, this.desktopConnectedView_.getShrinkToFit()); | 93 this.shrinkToFit_, this.desktopConnectedView_.getShrinkToFit()); |
86 | 94 |
87 if (this.fullscreen_) { | 95 if (this.fullscreen_) { |
88 remoting.MenuButton.select( | 96 remoting.MenuButton.select( |
89 this.fullscreen_, remoting.fullscreen.isActive()); | 97 this.fullscreen_, remoting.fullscreen.isActive()); |
90 } | 98 } |
(...skipping 20 matching lines...) Expand all Loading... |
111 this.desktopConnectedView_.sendCtrlAltDel(); | 119 this.desktopConnectedView_.sendCtrlAltDel(); |
112 } | 120 } |
113 }; | 121 }; |
114 | 122 |
115 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() { | 123 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() { |
116 if (this.desktopConnectedView_) { | 124 if (this.desktopConnectedView_) { |
117 this.desktopConnectedView_.sendPrintScreen(); | 125 this.desktopConnectedView_.sendPrintScreen(); |
118 } | 126 } |
119 }; | 127 }; |
120 | 128 |
| 129 remoting.OptionsMenu.prototype.onMapRightCtrl_ = function() { |
| 130 if (this.desktopConnectedView_) { |
| 131 this.desktopConnectedView_.setMapRightCtrl( |
| 132 !this.desktopConnectedView_.getMapRightCtrl()); |
| 133 } |
| 134 }; |
| 135 |
121 remoting.OptionsMenu.prototype.onResizeToClient_ = function() { | 136 remoting.OptionsMenu.prototype.onResizeToClient_ = function() { |
122 if (this.desktopConnectedView_) { | 137 if (this.desktopConnectedView_) { |
123 this.desktopConnectedView_.setScreenMode( | 138 this.desktopConnectedView_.setScreenMode( |
124 this.desktopConnectedView_.getShrinkToFit(), | 139 this.desktopConnectedView_.getShrinkToFit(), |
125 !this.desktopConnectedView_.getResizeToClient()); | 140 !this.desktopConnectedView_.getResizeToClient()); |
126 } | 141 } |
127 }; | 142 }; |
128 | 143 |
129 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() { | 144 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() { |
130 if (this.desktopConnectedView_) { | 145 if (this.desktopConnectedView_) { |
(...skipping 24 matching lines...) Expand all Loading... |
155 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() { | 170 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() { |
156 if (this.desktopConnectedView_) { | 171 if (this.desktopConnectedView_) { |
157 this.desktopConnectedView_.startStopRecording(); | 172 this.desktopConnectedView_.startStopRecording(); |
158 } | 173 } |
159 }; | 174 }; |
160 | 175 |
161 /** | 176 /** |
162 * @type {remoting.OptionsMenu} | 177 * @type {remoting.OptionsMenu} |
163 */ | 178 */ |
164 remoting.optionsMenu = null; | 179 remoting.optionsMenu = null; |
OLD | NEW |