OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 user-facing aspects of the client session. | 7 * Class handling user-facing aspects of the client session. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 /** | 99 /** |
100 * @return {boolean} True if resize-to-client is enabled; false otherwise. | 100 * @return {boolean} True if resize-to-client is enabled; false otherwise. |
101 */ | 101 */ |
102 remoting.DesktopConnectedView.prototype.getResizeToClient = function() { | 102 remoting.DesktopConnectedView.prototype.getResizeToClient = function() { |
103 if (this.viewport_) { | 103 if (this.viewport_) { |
104 return this.viewport_.getResizeToClient(); | 104 return this.viewport_.getResizeToClient(); |
105 } | 105 } |
106 return false; | 106 return false; |
107 }; | 107 }; |
108 | 108 |
109 /** | |
110 * @return {boolean} True if the right-hand Ctrl key should be remapped to the | |
kelvinp
2015/06/05 20:47:58
s/should be remapped/is current mapped
Jamie
2015/06/05 20:58:41
Done.
| |
111 * Meta (Windows, Command) key. | |
112 */ | |
113 remoting.DesktopConnectedView.prototype.getMapRightCtrl = function() { | |
114 return this.host_.options.remapKeys[0x0700e4] == 0x0700e7; | |
kelvinp
2015/06/05 20:47:58
use === equals
Jamie
2015/06/05 20:58:41
Done.
| |
115 }; | |
116 | |
109 remoting.DesktopConnectedView.prototype.toggleStats = function() { | 117 remoting.DesktopConnectedView.prototype.toggleStats = function() { |
110 this.stats_.toggle(); | 118 this.stats_.toggle(); |
111 }; | 119 }; |
112 | 120 |
113 /** | 121 /** |
114 * @return {boolean} True if the connection stats is visible; false otherwise. | 122 * @return {boolean} True if the connection stats is visible; false otherwise. |
115 */ | 123 */ |
116 remoting.DesktopConnectedView.prototype.isStatsVisible = function() { | 124 remoting.DesktopConnectedView.prototype.isStatsVisible = function() { |
117 return this.stats_.isVisible(); | 125 return this.stats_.isVisible(); |
118 }; | 126 }; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 // Fullscreen.isActive call is not guaranteed to return true until the | 236 // Fullscreen.isActive call is not guaranteed to return true until the |
229 // full-screen event is triggered. In apps v2, the size of the window's | 237 // full-screen event is triggered. In apps v2, the size of the window's |
230 // client area is calculated differently in full-screen mode, so register | 238 // client area is calculated differently in full-screen mode, so register |
231 // for both events. | 239 // for both events. |
232 this.viewport_.onResize(); | 240 this.viewport_.onResize(); |
233 this.viewport_.enableBumpScroll(Boolean(fullscreen)); | 241 this.viewport_.enableBumpScroll(Boolean(fullscreen)); |
234 } | 242 } |
235 }; | 243 }; |
236 | 244 |
237 /** | 245 /** |
246 * Set whether or not the right-hand Ctrl key should send the Meta (Windows, | |
247 * Command) key-code. | |
248 * | |
249 * @param {boolean} enable True to enable the mapping; false to disable. | |
250 */ | |
251 remoting.DesktopConnectedView.prototype.setMapRightCtrl = function(enable) { | |
252 if (enable === this.getMapRightCtrl()) { | |
kelvinp
2015/06/05 20:47:58
Nit: No need to use === to compare with boolean, e
Jamie
2015/06/05 20:58:41
I'm not comparing to true; I'm early-exiting if th
kelvinp
2015/06/06 00:54:26
Sorry, I misread
| |
253 return; // In case right Ctrl is mapped, but not to right Meta. | |
254 } | |
255 | |
256 if (enable) { | |
257 this.host_.options.remapKeys[0x0700e4] = 0x0700e7; | |
258 } else { | |
259 delete this.host_.options.remapKeys[0x0700e4] | |
260 } | |
261 this.setRemapKeys(this.host_.options.remapKeys); | |
262 }; | |
263 | |
264 /** | |
238 * Sends a Ctrl-Alt-Del sequence to the remoting client. | 265 * Sends a Ctrl-Alt-Del sequence to the remoting client. |
239 * | 266 * |
240 * @return {void} Nothing. | 267 * @return {void} Nothing. |
241 */ | 268 */ |
242 remoting.DesktopConnectedView.prototype.sendCtrlAltDel = function() { | 269 remoting.DesktopConnectedView.prototype.sendCtrlAltDel = function() { |
243 console.log('Sending Ctrl-Alt-Del.'); | 270 console.log('Sending Ctrl-Alt-Del.'); |
244 this.plugin_.injectKeyCombination([0x0700e0, 0x0700e2, 0x07004c]); | 271 this.plugin_.injectKeyCombination([0x0700e0, 0x0700e2, 0x07004c]); |
245 }; | 272 }; |
246 | 273 |
247 /** | 274 /** |
248 * Sends a Print Screen keypress to the remoting client. | 275 * Sends a Print Screen keypress to the remoting client. |
249 * | 276 * |
250 * @return {void} Nothing. | 277 * @return {void} Nothing. |
251 */ | 278 */ |
252 remoting.DesktopConnectedView.prototype.sendPrintScreen = function() { | 279 remoting.DesktopConnectedView.prototype.sendPrintScreen = function() { |
253 console.log('Sending Print Screen.'); | 280 console.log('Sending Print Screen.'); |
254 this.plugin_.injectKeyCombination([0x070046]); | 281 this.plugin_.injectKeyCombination([0x070046]); |
255 }; | 282 }; |
256 | 283 |
257 /** | 284 /** |
258 * Sets and stores the key remapping setting for the current host. If set, | 285 * Sets and stores the key remapping setting for the current host. If set, |
259 * these mappings override the defaults for the client platform. | 286 * these mappings override the defaults for the client platform. |
260 * | 287 * |
261 * @param {!Object} remappings | 288 * @param {!Object} remappings |
262 */ | 289 */ |
263 remoting.DesktopConnectedView.prototype.setRemapKeys = function(remappings) { | 290 remoting.DesktopConnectedView.prototype.setRemapKeys = function(remappings) { |
264 this.plugin_.setRemapKeys(remappings); | 291 this.plugin_.setRemapKeys(remappings); |
265 // Save the new remapping setting. | 292 // Save the new remapping setting. |
266 this.host_.options.remapKeys = remappings; | 293 this.host_.options.remapKeys = |
294 /** @type {!Object} */ (base.deepCopy(remappings)); | |
267 this.host_.options.save(); | 295 this.host_.options.save(); |
268 }; | 296 }; |
269 | 297 |
270 /** @param {remoting.VideoFrameRecorder} recorder */ | 298 /** @param {remoting.VideoFrameRecorder} recorder */ |
271 remoting.DesktopConnectedView.prototype.setVideoFrameRecorder = | 299 remoting.DesktopConnectedView.prototype.setVideoFrameRecorder = |
272 function(recorder) { | 300 function(recorder) { |
273 this.videoFrameRecorder_ = recorder; | 301 this.videoFrameRecorder_ = recorder; |
274 }; | 302 }; |
275 | 303 |
276 /** | 304 /** |
(...skipping 16 matching lines...) Expand all Loading... | |
293 }; | 321 }; |
294 | 322 |
295 /** | 323 /** |
296 * Starts or stops recording of video frames. | 324 * Starts or stops recording of video frames. |
297 */ | 325 */ |
298 remoting.DesktopConnectedView.prototype.startStopRecording = function() { | 326 remoting.DesktopConnectedView.prototype.startStopRecording = function() { |
299 if (this.videoFrameRecorder_) { | 327 if (this.videoFrameRecorder_) { |
300 this.videoFrameRecorder_.startStopRecording(); | 328 this.videoFrameRecorder_.startStopRecording(); |
301 } | 329 } |
302 }; | 330 }; |
OLD | NEW |