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

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

Issue 1153923007: Add a menu option for the right-hand Ctrl -> Meta mapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename Super to Meta. Created 5 years, 6 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
OLDNEW
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
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
111 * Meta (Windows, Command) key.
112 */
113 remoting.DesktopConnectedView.prototype.getMapRightCtrl = function() {
114 var currentMapping = this.host_.options.remapKeys;
115 return currentMapping.search('0x0700e4>0x0700e7') !== -1;
116 };
117
109 remoting.DesktopConnectedView.prototype.toggleStats = function() { 118 remoting.DesktopConnectedView.prototype.toggleStats = function() {
110 this.stats_.toggle(); 119 this.stats_.toggle();
111 }; 120 };
112 121
113 /** 122 /**
114 * @return {boolean} True if the connection stats is visible; false otherwise. 123 * @return {boolean} True if the connection stats is visible; false otherwise.
115 */ 124 */
116 remoting.DesktopConnectedView.prototype.isStatsVisible = function() { 125 remoting.DesktopConnectedView.prototype.isStatsVisible = function() {
117 return this.stats_.isVisible(); 126 return this.stats_.isVisible();
118 }; 127 };
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // Fullscreen.isActive call is not guaranteed to return true until the 237 // 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 238 // 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 239 // client area is calculated differently in full-screen mode, so register
231 // for both events. 240 // for both events.
232 this.viewport_.onResize(); 241 this.viewport_.onResize();
233 this.viewport_.enableBumpScroll(Boolean(fullscreen)); 242 this.viewport_.enableBumpScroll(Boolean(fullscreen));
234 } 243 }
235 }; 244 };
236 245
237 /** 246 /**
247 * Set whether or not the right-hand Ctrl key should send the Meta (Windows,
248 * Command) key-code.
249 *
250 * @param {boolean} enable True to enable the mapping; false to disable.
251 */
252 remoting.DesktopConnectedView.prototype.setMapRightCtrl = function(enable) {
253 if (enable === this.getMapRightCtrl()) {
254 return;
255 }
256 var currentMapping = this.host_.options.remapKeys;
257 if (enable) {
258 var separator = (currentMapping === '') ? '' : ',';
259 currentMapping += (separator + '0x0700e4>0x0700e7');
Wez 2015/06/01 19:47:57 This code's made complex by the need to support th
Jamie 2015/06/01 19:59:51 Storing it as a map would make it less complex, so
Wez 2015/06/01 20:01:36 Right - my point is that your current code is copi
Jamie 2015/06/01 22:27:02 I've simplified the implementation as you suggest.
Wez 2015/06/02 17:32:56 I'm fine with landing this simple version of the p
260 } else {
261 // Remove the right-ctrl mapping and either a leading or trailing comma (but
262 // not both) if there is one.
263 currentMapping = currentMapping.replace(/0x0700e4>0x0700e7,/, '');
kelvinp 2015/06/01 18:57:14 Not in this CL, but i think it would be more natur
Wez 2015/06/01 19:47:57 +1
264 currentMapping = currentMapping.replace(/,{0,1}0x0700e4>0x0700e7/, '');
265 }
266 this.setRemapKeys(currentMapping);
267 };
268
269 /**
238 * Sends a Ctrl-Alt-Del sequence to the remoting client. 270 * Sends a Ctrl-Alt-Del sequence to the remoting client.
239 * 271 *
240 * @return {void} Nothing. 272 * @return {void} Nothing.
241 */ 273 */
242 remoting.DesktopConnectedView.prototype.sendCtrlAltDel = function() { 274 remoting.DesktopConnectedView.prototype.sendCtrlAltDel = function() {
243 console.log('Sending Ctrl-Alt-Del.'); 275 console.log('Sending Ctrl-Alt-Del.');
244 this.plugin_.injectKeyCombination([0x0700e0, 0x0700e2, 0x07004c]); 276 this.plugin_.injectKeyCombination([0x0700e0, 0x0700e2, 0x07004c]);
245 }; 277 };
246 278
247 /** 279 /**
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 }; 325 };
294 326
295 /** 327 /**
296 * Starts or stops recording of video frames. 328 * Starts or stops recording of video frames.
297 */ 329 */
298 remoting.DesktopConnectedView.prototype.startStopRecording = function() { 330 remoting.DesktopConnectedView.prototype.startStopRecording = function() {
299 if (this.videoFrameRecorder_) { 331 if (this.videoFrameRecorder_) {
300 this.videoFrameRecorder_.startStopRecording(); 332 this.videoFrameRecorder_.startStopRecording();
301 } 333 }
302 }; 334 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698