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 remoting.MenuButton.select( | |
86 this.mapRightCtrl_, this.desktopConnectedView_.getMapRightCtrl()); | |
Wez
2015/06/01 19:47:57
Do we want to show this option even on non-ChromeO
Jamie
2015/06/01 19:59:51
I think you're probably right. I was thinking that
Wez
2015/06/02 17:32:56
SGTM
If we're going to make this general purpose
| |
87 | |
81 this.resizeToClient_.hidden = mode === remoting.DesktopRemoting.Mode.IT2ME; | 88 this.resizeToClient_.hidden = mode === remoting.DesktopRemoting.Mode.IT2ME; |
82 remoting.MenuButton.select( | 89 remoting.MenuButton.select( |
83 this.resizeToClient_, this.desktopConnectedView_.getResizeToClient()); | 90 this.resizeToClient_, this.desktopConnectedView_.getResizeToClient()); |
84 remoting.MenuButton.select( | 91 remoting.MenuButton.select( |
85 this.shrinkToFit_, this.desktopConnectedView_.getShrinkToFit()); | 92 this.shrinkToFit_, this.desktopConnectedView_.getShrinkToFit()); |
86 | 93 |
87 if (this.fullscreen_) { | 94 if (this.fullscreen_) { |
88 remoting.MenuButton.select( | 95 remoting.MenuButton.select( |
89 this.fullscreen_, remoting.fullscreen.isActive()); | 96 this.fullscreen_, remoting.fullscreen.isActive()); |
90 } | 97 } |
(...skipping 20 matching lines...) Expand all Loading... | |
111 this.desktopConnectedView_.sendCtrlAltDel(); | 118 this.desktopConnectedView_.sendCtrlAltDel(); |
112 } | 119 } |
113 }; | 120 }; |
114 | 121 |
115 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() { | 122 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() { |
116 if (this.desktopConnectedView_) { | 123 if (this.desktopConnectedView_) { |
117 this.desktopConnectedView_.sendPrintScreen(); | 124 this.desktopConnectedView_.sendPrintScreen(); |
118 } | 125 } |
119 }; | 126 }; |
120 | 127 |
128 remoting.OptionsMenu.prototype.onMapRightCtrl_ = function() { | |
129 if (this.desktopConnectedView_) { | |
130 this.desktopConnectedView_.setMapRightCtrl( | |
131 !this.desktopConnectedView_.getMapRightCtrl()); | |
132 } | |
133 }; | |
134 | |
121 remoting.OptionsMenu.prototype.onResizeToClient_ = function() { | 135 remoting.OptionsMenu.prototype.onResizeToClient_ = function() { |
122 if (this.desktopConnectedView_) { | 136 if (this.desktopConnectedView_) { |
123 this.desktopConnectedView_.setScreenMode( | 137 this.desktopConnectedView_.setScreenMode( |
124 this.desktopConnectedView_.getShrinkToFit(), | 138 this.desktopConnectedView_.getShrinkToFit(), |
125 !this.desktopConnectedView_.getResizeToClient()); | 139 !this.desktopConnectedView_.getResizeToClient()); |
126 } | 140 } |
127 }; | 141 }; |
128 | 142 |
129 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() { | 143 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() { |
130 if (this.desktopConnectedView_) { | 144 if (this.desktopConnectedView_) { |
(...skipping 24 matching lines...) Expand all Loading... | |
155 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() { | 169 remoting.OptionsMenu.prototype.onStartStopRecording_ = function() { |
156 if (this.desktopConnectedView_) { | 170 if (this.desktopConnectedView_) { |
157 this.desktopConnectedView_.startStopRecording(); | 171 this.desktopConnectedView_.startStopRecording(); |
158 } | 172 } |
159 }; | 173 }; |
160 | 174 |
161 /** | 175 /** |
162 * @type {remoting.OptionsMenu} | 176 * @type {remoting.OptionsMenu} |
163 */ | 177 */ |
164 remoting.optionsMenu = null; | 178 remoting.optionsMenu = null; |
OLD | NEW |