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

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

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 creation and teardown of a remoting client session. 7 * Class handling creation and teardown of a remoting client session.
8 * 8 *
9 * The ClientSession class controls lifetime of the client plugin 9 * The ClientSession class controls lifetime of the client plugin
10 * object and provides the plugin with the functionality it needs to 10 * object and provides the plugin with the functionality it needs to
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 * would not be useful, for example, when using a cached host JID. 162 * would not be useful, for example, when using a cached host JID.
163 * 163 *
164 * @type {boolean} @private 164 * @type {boolean} @private
165 */ 165 */
166 this.logHostOfflineErrors_ = true; 166 this.logHostOfflineErrors_ = true;
167 167
168 /** @private */ 168 /** @private */
169 this.callPluginLostFocus_ = this.pluginLostFocus_.bind(this); 169 this.callPluginLostFocus_ = this.pluginLostFocus_.bind(this);
170 /** @private */ 170 /** @private */
171 this.callPluginGotFocus_ = this.pluginGotFocus_.bind(this); 171 this.callPluginGotFocus_ = this.pluginGotFocus_.bind(this);
172 /** @private */ 172 /**
173 * @type {function(boolean=):void}
174 * @private
175 */
173 this.callOnFullScreenChanged_ = this.onFullScreenChanged_.bind(this) 176 this.callOnFullScreenChanged_ = this.onFullScreenChanged_.bind(this)
174 177
175 /** @type {Element} @private */ 178 /** @type {Element} @private */
176 this.mouseCursorOverlay_ = 179 this.mouseCursorOverlay_ =
177 this.container_.querySelector('.mouse-cursor-overlay'); 180 this.container_.querySelector('.mouse-cursor-overlay');
178 181
179 /** @type {Element} */ 182 /** @type {Element} */
180 var img = this.mouseCursorOverlay_; 183 var img = this.mouseCursorOverlay_;
181 /** @param {Event} event @private */ 184 /** @param {Event} event @private */
182 this.updateMouseCursorPosition_ = function(event) { 185 this.updateMouseCursorPosition_ = function(event) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 remoting.ClientSession.prototype.createPluginAndConnect = 471 remoting.ClientSession.prototype.createPluginAndConnect =
469 function(onExtensionMessage, requiredCapabilities) { 472 function(onExtensionMessage, requiredCapabilities) {
470 this.plugin_ = remoting.ClientPlugin.factory.createPlugin( 473 this.plugin_ = remoting.ClientPlugin.factory.createPlugin(
471 this.container_.querySelector('.client-plugin-container'), 474 this.container_.querySelector('.client-plugin-container'),
472 onExtensionMessage, requiredCapabilities); 475 onExtensionMessage, requiredCapabilities);
473 remoting.HostSettings.load(this.hostId_, 476 remoting.HostSettings.load(this.hostId_,
474 this.onHostSettingsLoaded_.bind(this)); 477 this.onHostSettingsLoaded_.bind(this));
475 }; 478 };
476 479
477 /** 480 /**
478 * @param {Object.<string>} options The current options for the host, or {} 481 * @param {Object.<string|boolean|number>} options The current options for the
479 * if this client has no saved settings for the host. 482 * host, or {} if this client has no saved settings for the host.
480 * @private 483 * @private
481 */ 484 */
482 remoting.ClientSession.prototype.onHostSettingsLoaded_ = function(options) { 485 remoting.ClientSession.prototype.onHostSettingsLoaded_ = function(options) {
483 if (remoting.ClientSession.KEY_REMAP_KEYS in options && 486 if (remoting.ClientSession.KEY_REMAP_KEYS in options &&
484 typeof(options[remoting.ClientSession.KEY_REMAP_KEYS]) == 487 typeof(options[remoting.ClientSession.KEY_REMAP_KEYS]) ==
485 'string') { 488 'string') {
486 this.remapKeys_ = /** @type {string} */ 489 this.remapKeys_ = /** @type {string} */
487 options[remoting.ClientSession.KEY_REMAP_KEYS]; 490 (options[remoting.ClientSession.KEY_REMAP_KEYS]);
488 } 491 }
489 if (remoting.ClientSession.KEY_RESIZE_TO_CLIENT in options && 492 if (remoting.ClientSession.KEY_RESIZE_TO_CLIENT in options &&
490 typeof(options[remoting.ClientSession.KEY_RESIZE_TO_CLIENT]) == 493 typeof(options[remoting.ClientSession.KEY_RESIZE_TO_CLIENT]) ==
491 'boolean') { 494 'boolean') {
492 this.resizeToClient_ = /** @type {boolean} */ 495 this.resizeToClient_ = /** @type {boolean} */
493 options[remoting.ClientSession.KEY_RESIZE_TO_CLIENT]; 496 (options[remoting.ClientSession.KEY_RESIZE_TO_CLIENT]);
494 } 497 }
495 if (remoting.ClientSession.KEY_SHRINK_TO_FIT in options && 498 if (remoting.ClientSession.KEY_SHRINK_TO_FIT in options &&
496 typeof(options[remoting.ClientSession.KEY_SHRINK_TO_FIT]) == 499 typeof(options[remoting.ClientSession.KEY_SHRINK_TO_FIT]) ==
497 'boolean') { 500 'boolean') {
498 this.shrinkToFit_ = /** @type {boolean} */ 501 this.shrinkToFit_ = /** @type {boolean} */
499 options[remoting.ClientSession.KEY_SHRINK_TO_FIT]; 502 (options[remoting.ClientSession.KEY_SHRINK_TO_FIT]);
500 } 503 }
501 if (remoting.ClientSession.KEY_DESKTOP_SCALE in options && 504 if (remoting.ClientSession.KEY_DESKTOP_SCALE in options &&
502 typeof(options[remoting.ClientSession.KEY_DESKTOP_SCALE]) == 505 typeof(options[remoting.ClientSession.KEY_DESKTOP_SCALE]) ==
503 'number') { 506 'number') {
504 this.desktopScale_ = /** @type {number} */ 507 this.desktopScale_ = /** @type {number} */
505 options[remoting.ClientSession.KEY_DESKTOP_SCALE]; 508 (options[remoting.ClientSession.KEY_DESKTOP_SCALE]);
506 } 509 }
507 510
508 /** @param {boolean} result */ 511 /** @param {boolean} result */
509 this.plugin_.initialize(this.onPluginInitialized_.bind(this)); 512 this.plugin_.initialize(this.onPluginInitialized_.bind(this));
510 }; 513 };
511 514
512 /** 515 /**
513 * Constrains the focus to the plugin element. 516 * Constrains the focus to the plugin element.
514 * @private 517 * @private
515 */ 518 */
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 * @return {remoting.Error} The current error code. 710 * @return {remoting.Error} The current error code.
708 */ 711 */
709 remoting.ClientSession.prototype.getError = function() { 712 remoting.ClientSession.prototype.getError = function() {
710 return this.error_; 713 return this.error_;
711 }; 714 };
712 715
713 /** 716 /**
714 * Sends a key combination to the remoting client, by sending down events for 717 * Sends a key combination to the remoting client, by sending down events for
715 * the given keys, followed by up events in reverse order. 718 * the given keys, followed by up events in reverse order.
716 * 719 *
720 * @param {Array.<number>} keys Key codes to be sent.
721 * @return {void} Nothing.
717 * @private 722 * @private
718 * @param {[number]} keys Key codes to be sent.
719 * @return {void} Nothing.
720 */ 723 */
721 remoting.ClientSession.prototype.sendKeyCombination_ = function(keys) { 724 remoting.ClientSession.prototype.sendKeyCombination_ = function(keys) {
722 for (var i = 0; i < keys.length; i++) { 725 for (var i = 0; i < keys.length; i++) {
723 this.plugin_.injectKeyEvent(keys[i], true); 726 this.plugin_.injectKeyEvent(keys[i], true);
724 } 727 }
725 for (var i = 0; i < keys.length; i++) { 728 for (var i = 0; i < keys.length; i++) {
726 this.plugin_.injectKeyEvent(keys[i], false); 729 this.plugin_.injectKeyEvent(keys[i], false);
727 } 730 }
728 } 731 }
729 732
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 /** 877 /**
875 * @return {boolean} Whether the client has received a video buffer. 878 * @return {boolean} Whether the client has received a video buffer.
876 */ 879 */
877 remoting.ClientSession.prototype.hasReceivedFrame = function() { 880 remoting.ClientSession.prototype.hasReceivedFrame = function() {
878 return this.hasReceivedFrame_; 881 return this.hasReceivedFrame_;
879 }; 882 };
880 883
881 /** 884 /**
882 * Sends a signaling message. 885 * Sends a signaling message.
883 * 886 *
884 * @private
885 * @param {string} message XML string of IQ stanza to send to server. 887 * @param {string} message XML string of IQ stanza to send to server.
886 * @return {void} Nothing. 888 * @return {void} Nothing.
889 * @private
887 */ 890 */
888 remoting.ClientSession.prototype.sendIq_ = function(message) { 891 remoting.ClientSession.prototype.sendIq_ = function(message) {
889 // Extract the session id, so we can close the session later. 892 // Extract the session id, so we can close the session later.
890 var parser = new DOMParser(); 893 var parser = new DOMParser();
891 var iqNode = parser.parseFromString(message, 'text/xml').firstChild; 894 var iqNode = parser.parseFromString(message, 'text/xml').firstChild;
892 var jingleNode = iqNode.firstChild; 895 var jingleNode = iqNode.firstChild;
893 if (jingleNode) { 896 if (jingleNode) {
894 var action = jingleNode.getAttribute('action'); 897 var action = jingleNode.getAttribute('action');
895 if (jingleNode.nodeName == 'jingle' && action == 'session-initiate') { 898 if (jingleNode.nodeName == 'jingle' && action == 'session-initiate') {
896 this.sessionId_ = jingleNode.getAttribute('sid'); 899 this.sessionId_ = jingleNode.getAttribute('sid');
897 } 900 }
898 } 901 }
899 902
900 console.log(remoting.timestamp(), remoting.formatIq.prettifySendIq(message)); 903 console.log(remoting.timestamp(), remoting.formatIq.prettifySendIq(message));
901 if (this.signalStrategy_.getState() != 904 if (this.signalStrategy_.getState() !=
902 remoting.SignalStrategy.State.CONNECTED) { 905 remoting.SignalStrategy.State.CONNECTED) {
903 console.log("Message above is dropped because signaling is not connected."); 906 console.log("Message above is dropped because signaling is not connected.");
904 return; 907 return;
905 } 908 }
906 909
907 this.signalStrategy_.sendMessage(message); 910 this.signalStrategy_.sendMessage(message);
908 }; 911 };
909 912
910 /** 913 /**
914 * @param {string} msg
911 * @private 915 * @private
912 * @param {string} msg
913 */ 916 */
914 remoting.ClientSession.prototype.onDebugMessage_ = function(msg) { 917 remoting.ClientSession.prototype.onDebugMessage_ = function(msg) {
915 console.log('plugin: ' + msg.trimRight()); 918 console.log('plugin: ' + msg.trimRight());
916 }; 919 };
917 920
918 /** 921 /**
922 * @param {Element} message
919 * @private 923 * @private
920 * @param {Element} message
921 */ 924 */
922 remoting.ClientSession.prototype.onIncomingMessage_ = function(message) { 925 remoting.ClientSession.prototype.onIncomingMessage_ = function(message) {
923 if (!this.plugin_) { 926 if (!this.plugin_) {
924 return; 927 return;
925 } 928 }
926 var formatted = new XMLSerializer().serializeToString(message); 929 var formatted = new XMLSerializer().serializeToString(message);
927 console.log(remoting.timestamp(), 930 console.log(remoting.timestamp(),
928 remoting.formatIq.prettifyReceiveIq(formatted)); 931 remoting.formatIq.prettifyReceiveIq(formatted));
929 this.plugin_.onIncomingIq(formatted); 932 this.plugin_.onIncomingIq(formatted);
930 } 933 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 // Clients that don't support asking for a PIN asynchronously also don't 987 // Clients that don't support asking for a PIN asynchronously also don't
985 // support pairing, so request the PIN now without offering to remember it. 988 // support pairing, so request the PIN now without offering to remember it.
986 this.fetchPin_(false, callback); 989 this.fetchPin_(false, callback);
987 } 990 }
988 }; 991 };
989 992
990 /** 993 /**
991 * Callback that the plugin invokes to indicate that the connection 994 * Callback that the plugin invokes to indicate that the connection
992 * status has changed. 995 * status has changed.
993 * 996 *
994 * @private
995 * @param {number} status The plugin's status. 997 * @param {number} status The plugin's status.
996 * @param {number} error The plugin's error state, if any. 998 * @param {number} error The plugin's error state, if any.
999 * @private
997 */ 1000 */
998 remoting.ClientSession.prototype.onConnectionStatusUpdate_ = 1001 remoting.ClientSession.prototype.onConnectionStatusUpdate_ =
999 function(status, error) { 1002 function(status, error) {
1000 if (status == remoting.ClientSession.State.CONNECTED) { 1003 if (status == remoting.ClientSession.State.CONNECTED) {
1001 this.setFocusHandlers_(); 1004 this.setFocusHandlers_();
1002 this.onDesktopSizeChanged_(); 1005 this.onDesktopSizeChanged_();
1003 if (this.resizeToClient_) { 1006 if (this.resizeToClient_) {
1004 this.notifyClientResolution_(); 1007 this.notifyClientResolution_();
1005 } 1008 }
1006 // Activate full-screen related UX. 1009 // Activate full-screen related UX.
(...skipping 24 matching lines...) Expand all
1031 this.error_ = remoting.Error.UNEXPECTED; 1034 this.error_ = remoting.Error.UNEXPECTED;
1032 } 1035 }
1033 } 1036 }
1034 this.setState_(/** @type {remoting.ClientSession.State} */ (status)); 1037 this.setState_(/** @type {remoting.ClientSession.State} */ (status));
1035 }; 1038 };
1036 1039
1037 /** 1040 /**
1038 * Callback that the plugin invokes to indicate that the connection type for 1041 * Callback that the plugin invokes to indicate that the connection type for
1039 * a channel has changed. 1042 * a channel has changed.
1040 * 1043 *
1041 * @private
1042 * @param {string} channel The channel name. 1044 * @param {string} channel The channel name.
1043 * @param {string} connectionType The new connection type. 1045 * @param {string} connectionType The new connection type.
1046 * @private
1044 */ 1047 */
1045 remoting.ClientSession.prototype.onRouteChanged_ = 1048 remoting.ClientSession.prototype.onRouteChanged_ =
1046 function(channel, connectionType) { 1049 function(channel, connectionType) {
1047 console.log('plugin: Channel ' + channel + ' using ' + 1050 console.log('plugin: Channel ' + channel + ' using ' +
1048 connectionType + ' connection.'); 1051 connectionType + ' connection.');
1049 this.logToServer.setConnectionType(connectionType); 1052 this.logToServer.setConnectionType(connectionType);
1050 }; 1053 };
1051 1054
1052 /** 1055 /**
1053 * Callback that the plugin invokes to indicate when the connection is 1056 * Callback that the plugin invokes to indicate when the connection is
1054 * ready. 1057 * ready.
1055 * 1058 *
1059 * @param {boolean} ready True if the connection is ready.
1056 * @private 1060 * @private
1057 * @param {boolean} ready True if the connection is ready.
1058 */ 1061 */
1059 remoting.ClientSession.prototype.onConnectionReady_ = function(ready) { 1062 remoting.ClientSession.prototype.onConnectionReady_ = function(ready) {
1060 // TODO(jamiewalch): Currently, the logic for determining whether or not the 1063 // TODO(jamiewalch): Currently, the logic for determining whether or not the
1061 // connection is available is based solely on whether or not any video frames 1064 // connection is available is based solely on whether or not any video frames
1062 // have been received recently. which leads to poor UX on slow connections. 1065 // have been received recently. which leads to poor UX on slow connections.
1063 // Re-enable this once crbug.com/435315 has been fixed. 1066 // Re-enable this once crbug.com/435315 has been fixed.
1064 var ignoreVideoChannelState = true; 1067 var ignoreVideoChannelState = true;
1065 if (ignoreVideoChannelState) { 1068 if (ignoreVideoChannelState) {
1066 console.log('Video channel ' + (ready ? '' : 'not ') + 'ready.'); 1069 console.log('Video channel ' + (ready ? '' : 'not ') + 'ready.');
1067 return; 1070 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 if (this.hasCapability_(remoting.ClientSession.Capability.GOOGLE_DRIVE)) { 1102 if (this.hasCapability_(remoting.ClientSession.Capability.GOOGLE_DRIVE)) {
1100 this.sendGoogleDriveAccessToken_(); 1103 this.sendGoogleDriveAccessToken_();
1101 } 1104 }
1102 if (this.hasCapability_( 1105 if (this.hasCapability_(
1103 remoting.ClientSession.Capability.VIDEO_RECORDER)) { 1106 remoting.ClientSession.Capability.VIDEO_RECORDER)) {
1104 this.videoFrameRecorder_ = new remoting.VideoFrameRecorder(this.plugin_); 1107 this.videoFrameRecorder_ = new remoting.VideoFrameRecorder(this.plugin_);
1105 } 1108 }
1106 }; 1109 };
1107 1110
1108 /** 1111 /**
1109 * @private
1110 * @param {remoting.ClientSession.State} newState The new state for the session. 1112 * @param {remoting.ClientSession.State} newState The new state for the session.
1111 * @return {void} Nothing. 1113 * @return {void} Nothing.
1114 * @private
1112 */ 1115 */
1113 remoting.ClientSession.prototype.setState_ = function(newState) { 1116 remoting.ClientSession.prototype.setState_ = function(newState) {
1114 var oldState = this.state_; 1117 var oldState = this.state_;
1115 this.state_ = newState; 1118 this.state_ = newState;
1116 var state = this.state_; 1119 var state = this.state_;
1117 if (oldState == remoting.ClientSession.State.CONNECTING) { 1120 if (oldState == remoting.ClientSession.State.CONNECTING) {
1118 if (this.state_ == remoting.ClientSession.State.CLOSED) { 1121 if (this.state_ == remoting.ClientSession.State.CLOSED) {
1119 state = remoting.ClientSession.State.CONNECTION_CANCELED; 1122 state = remoting.ClientSession.State.CONNECTION_CANCELED;
1120 } else if (this.state_ == remoting.ClientSession.State.FAILED && 1123 } else if (this.state_ == remoting.ClientSession.State.FAILED &&
1121 this.error_ == remoting.Error.HOST_IS_OFFLINE && 1124 this.error_ == remoting.Error.HOST_IS_OFFLINE &&
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 remoting.ClientSession.prototype.pauseAudio = function(pause) { 1198 remoting.ClientSession.prototype.pauseAudio = function(pause) {
1196 if (this.plugin_) { 1199 if (this.plugin_) {
1197 this.plugin_.pauseAudio(pause) 1200 this.plugin_.pauseAudio(pause)
1198 } 1201 }
1199 } 1202 }
1200 1203
1201 /** 1204 /**
1202 * This is a callback that gets called when the plugin notifies us of a change 1205 * This is a callback that gets called when the plugin notifies us of a change
1203 * in the size of the remote desktop. 1206 * in the size of the remote desktop.
1204 * 1207 *
1208 * @return {void} Nothing.
1205 * @private 1209 * @private
1206 * @return {void} Nothing.
1207 */ 1210 */
1208 remoting.ClientSession.prototype.onDesktopSizeChanged_ = function() { 1211 remoting.ClientSession.prototype.onDesktopSizeChanged_ = function() {
1209 console.log('desktop size changed: ' + 1212 console.log('desktop size changed: ' +
1210 this.plugin_.getDesktopWidth() + 'x' + 1213 this.plugin_.getDesktopWidth() + 'x' +
1211 this.plugin_.getDesktopHeight() +' @ ' + 1214 this.plugin_.getDesktopHeight() +' @ ' +
1212 this.plugin_.getDesktopXDpi() + 'x' + 1215 this.plugin_.getDesktopXDpi() + 'x' +
1213 this.plugin_.getDesktopYDpi() + ' DPI'); 1216 this.plugin_.getDesktopYDpi() + ' DPI');
1214 this.updateDimensions(); 1217 this.updateDimensions();
1215 this.updateScrollbarVisibility(); 1218 this.updateScrollbarVisibility();
1216 }; 1219 };
1217 1220
1218 /** 1221 /**
1219 * Sets the non-click-through area of the client in response to notifications 1222 * Sets the non-click-through area of the client in response to notifications
1220 * from the plugin of desktop shape changes. 1223 * from the plugin of desktop shape changes.
1221 * 1224 *
1222 * @private
1223 * @param {Array.<Array.<number>>} rects List of rectangles comprising the 1225 * @param {Array.<Array.<number>>} rects List of rectangles comprising the
1224 * desktop shape. 1226 * desktop shape.
1225 * @return {void} Nothing. 1227 * @return {void} Nothing.
1228 * @private
1226 */ 1229 */
1227 remoting.ClientSession.prototype.onDesktopShapeChanged_ = function(rects) { 1230 remoting.ClientSession.prototype.onDesktopShapeChanged_ = function(rects) {
1228 // Build the list of rects for the input region. 1231 // Build the list of rects for the input region.
1229 var inputRegion = []; 1232 var inputRegion = [];
1230 for (var i = 0; i < rects.length; ++i) { 1233 for (var i = 0; i < rects.length; ++i) {
1231 var rect = {}; 1234 var rect = {};
1232 rect.left = rects[i][0]; 1235 rect.left = rects[i][0];
1233 rect.top = rects[i][1]; 1236 rect.top = rects[i][1];
1234 rect.width = rects[i][2]; 1237 rect.width = rects[i][2];
1235 rect.height = rects[i][3]; 1238 rect.height = rects[i][3];
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 remoting.ClientSession.prototype.requestPairing = function(clientName, onDone) { 1372 remoting.ClientSession.prototype.requestPairing = function(clientName, onDone) {
1370 if (this.plugin_) { 1373 if (this.plugin_) {
1371 this.plugin_.requestPairing(clientName, onDone); 1374 this.plugin_.requestPairing(clientName, onDone);
1372 } 1375 }
1373 }; 1376 };
1374 1377
1375 /** 1378 /**
1376 * Called when the full-screen status has changed, either via the 1379 * Called when the full-screen status has changed, either via the
1377 * remoting.Fullscreen class, or via a system event such as the Escape key 1380 * remoting.Fullscreen class, or via a system event such as the Escape key
1378 * 1381 *
1379 * @param {boolean} fullscreen True if the app is entering full-screen mode; 1382 * @param {boolean=} fullscreen True if the app is entering full-screen mode;
1380 * false if it is leaving it. 1383 * false if it is leaving it.
1381 * @private 1384 * @private
1382 */ 1385 */
1383 remoting.ClientSession.prototype.onFullScreenChanged_ = function (fullscreen) { 1386 remoting.ClientSession.prototype.onFullScreenChanged_ = function (fullscreen) {
1384 this.enableBumpScroll_(fullscreen); 1387 this.enableBumpScroll_(fullscreen);
1385 }; 1388 };
1386 1389
1387 /** 1390 /**
1388 * Scroll the client plugin by the specified amount, keeping it visible. 1391 * Scroll the client plugin by the specified amount, keeping it visible.
1389 * Note that this is only used in content full-screen mode (not windowed or 1392 * Note that this is only used in content full-screen mode (not windowed or
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 }; 1436 };
1434 1437
1435 remoting.ClientSession.prototype.resetScroll_ = function() { 1438 remoting.ClientSession.prototype.resetScroll_ = function() {
1436 this.container_.style.marginTop = '0px'; 1439 this.container_.style.marginTop = '0px';
1437 this.container_.style.marginLeft = '0px'; 1440 this.container_.style.marginLeft = '0px';
1438 }; 1441 };
1439 1442
1440 /** 1443 /**
1441 * Enable or disable bump-scrolling. When disabling bump scrolling, also reset 1444 * Enable or disable bump-scrolling. When disabling bump scrolling, also reset
1442 * the scroll offsets to (0, 0). 1445 * the scroll offsets to (0, 0).
1446 * @param {boolean=} enable True to enable bump-scrolling, false to disable it.
1443 * @private 1447 * @private
1444 * @param {boolean} enable True to enable bump-scrolling, false to disable it.
1445 */ 1448 */
1446 remoting.ClientSession.prototype.enableBumpScroll_ = function(enable) { 1449 remoting.ClientSession.prototype.enableBumpScroll_ = function(enable) {
1447 var element = /*@type{HTMLElement} */ document.documentElement; 1450 var element = /** @type{HTMLElement} */ (document.documentElement);
1448 if (enable) { 1451 if (enable) {
1449 /** @type {null|function(Event):void} */ 1452 /** @type {null|function(Event):void} */
1450 this.onMouseMoveRef_ = this.onMouseMove_.bind(this); 1453 this.onMouseMoveRef_ = this.onMouseMove_.bind(this);
1451 element.addEventListener('mousemove', this.onMouseMoveRef_, false); 1454 element.addEventListener('mousemove', this.onMouseMoveRef_, false);
1452 } else { 1455 } else {
1453 element.removeEventListener('mousemove', this.onMouseMoveRef_, false); 1456 element.removeEventListener('mousemove', this.onMouseMoveRef_, false);
1454 this.onMouseMoveRef_ = null; 1457 this.onMouseMoveRef_ = null;
1455 this.resetScroll_(); 1458 this.resetScroll_();
1456 } 1459 }
1457 }; 1460 };
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1552
1550 /** 1553 /**
1551 * Process a remote gnubby auth request. 1554 * Process a remote gnubby auth request.
1552 * @param {string} data Remote gnubby request data. 1555 * @param {string} data Remote gnubby request data.
1553 * @private 1556 * @private
1554 */ 1557 */
1555 remoting.ClientSession.prototype.processGnubbyAuthMessage_ = function(data) { 1558 remoting.ClientSession.prototype.processGnubbyAuthMessage_ = function(data) {
1556 if (this.gnubbyAuthHandler_) { 1559 if (this.gnubbyAuthHandler_) {
1557 try { 1560 try {
1558 this.gnubbyAuthHandler_.onMessage(data); 1561 this.gnubbyAuthHandler_.onMessage(data);
1559 } catch (err) { 1562 } catch (/** @type {*} */ err) {
1560 console.error('Failed to process gnubby message: ', 1563 console.error('Failed to process gnubby message: ', err);
1561 /** @type {*} */ (err));
1562 } 1564 }
1563 } else { 1565 } else {
1564 console.error('Received unexpected gnubby message'); 1566 console.error('Received unexpected gnubby message');
1565 } 1567 }
1566 }; 1568 };
1567 1569
1568 /** 1570 /**
1569 * Create a gnubby auth handler and inform the host that gnubby auth is 1571 * Create a gnubby auth handler and inform the host that gnubby auth is
1570 * supported. 1572 * supported.
1571 * @private 1573 * @private
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 1667
1666 /** 1668 /**
1667 * Process a remote Cast extension message from the host. 1669 * Process a remote Cast extension message from the host.
1668 * @param {string} data Remote cast extension data message. 1670 * @param {string} data Remote cast extension data message.
1669 * @private 1671 * @private
1670 */ 1672 */
1671 remoting.ClientSession.prototype.processCastExtensionMessage_ = function(data) { 1673 remoting.ClientSession.prototype.processCastExtensionMessage_ = function(data) {
1672 if (this.castExtensionHandler_) { 1674 if (this.castExtensionHandler_) {
1673 try { 1675 try {
1674 this.castExtensionHandler_.onMessage(data); 1676 this.castExtensionHandler_.onMessage(data);
1675 } catch (err) { 1677 } catch (/** @type {*} */ err) {
1676 console.error('Failed to process cast message: ', 1678 console.error('Failed to process cast message: ', err);
1677 /** @type {*} */ (err));
1678 } 1679 }
1679 } else { 1680 } else {
1680 console.error('Received unexpected cast message'); 1681 console.error('Received unexpected cast message');
1681 } 1682 }
1682 }; 1683 };
1683 1684
1684 /** 1685 /**
1685 * Create a CastExtensionHandler and inform the host that cast extension 1686 * Create a CastExtensionHandler and inform the host that cast extension
1686 * is supported. 1687 * is supported.
1687 * @private 1688 * @private
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 * @param {Object} message The parsed extension message data. 1727 * @param {Object} message The parsed extension message data.
1727 * @return {boolean} True if the message was recognized, false otherwise. 1728 * @return {boolean} True if the message was recognized, false otherwise.
1728 */ 1729 */
1729 remoting.ClientSession.prototype.handleExtensionMessage = 1730 remoting.ClientSession.prototype.handleExtensionMessage =
1730 function(type, message) { 1731 function(type, message) {
1731 if (this.videoFrameRecorder_) { 1732 if (this.videoFrameRecorder_) {
1732 return this.videoFrameRecorder_.handleMessage(type, message); 1733 return this.videoFrameRecorder_.handleMessage(type, message);
1733 } 1734 }
1734 return false; 1735 return false;
1735 } 1736 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698