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

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

Issue 1078563002: [Webapp Refactor] Clean up remoting.Clipboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 that wraps low-level details of interacting with the client plugin. 7 * Class that wraps low-level details of interacting with the client plugin.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does 9 * This abstracts a <embed> element and controls the plugin which does
10 * the actual remoting work. It also handles differences between 10 * the actual remoting work. It also handles differences between
(...skipping 26 matching lines...) Expand all
37 this.plugin_ = remoting.ClientPluginImpl.createPluginElement_(); 37 this.plugin_ = remoting.ClientPluginImpl.createPluginElement_();
38 this.plugin_.id = 'session-client-plugin'; 38 this.plugin_.id = 'session-client-plugin';
39 container.appendChild(this.plugin_); 39 container.appendChild(this.plugin_);
40 40
41 /** @private {Array<string>} */ 41 /** @private {Array<string>} */
42 this.requiredCapabilities_ = requiredCapabilities; 42 this.requiredCapabilities_ = requiredCapabilities;
43 43
44 /** @private {remoting.ClientPlugin.ConnectionEventHandler} */ 44 /** @private {remoting.ClientPlugin.ConnectionEventHandler} */
45 this.connectionEventHandler_ = null; 45 this.connectionEventHandler_ = null;
46 46
47 /** 47 /** @private {?function(string, number, number)} */
48 * @param {string} data Remote gnubbyd data. 48 this.updateMouseCursorImage_ = base.doNothing;
49 * @private 49 /** @private {?function(string, string)} */
50 */ 50 this.updateClipboardData_ = base.doNothing;
51 this.onGnubbyAuthHandler_ = function(data) {}; 51 /** @private {?function(string)} */
kelvinp 2015/04/09 00:28:26 Removed as this is not referenced else where.
52 /** 52 this.onCastExtensionHandler_ = base.doNothing;
53 * @param {string} url
54 * @param {number} hotspotX
55 * @param {number} hotspotY
56 * @private
57 */
58 this.updateMouseCursorImage_ = function(url, hotspotX, hotspotY) {};
59 /**
60 * @param {string} data Remote cast extension message.
61 * @private
62 */
63 this.onCastExtensionHandler_ = function(data) {};
64 /** @private {?function({rects:Array<Array<number>>}):void} */ 53 /** @private {?function({rects:Array<Array<number>>}):void} */
65 this.debugRegionHandler_ = null; 54 this.debugRegionHandler_ = null;
66 55
67 /** @private {number} */ 56 /** @private {number} */
68 this.pluginApiVersion_ = -1; 57 this.pluginApiVersion_ = -1;
69 /** @private {Array<string>} */ 58 /** @private {Array<string>} */
70 this.pluginApiFeatures_ = []; 59 this.pluginApiFeatures_ = [];
71 /** @private {number} */ 60 /** @private {number} */
72 this.pluginApiMinVersion_ = -1; 61 this.pluginApiMinVersion_ = -1;
73 /** @private {!Array<string>} */ 62 /** @private {!Array<string>} */
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 }; 150 };
162 151
163 /** 152 /**
164 * @param {function(string, number, number):void} handler 153 * @param {function(string, number, number):void} handler
165 */ 154 */
166 remoting.ClientPluginImpl.prototype.setMouseCursorHandler = function(handler) { 155 remoting.ClientPluginImpl.prototype.setMouseCursorHandler = function(handler) {
167 this.updateMouseCursorImage_ = handler; 156 this.updateMouseCursorImage_ = handler;
168 }; 157 };
169 158
170 /** 159 /**
160 * @param {function(string, string):void} handler
161 */
162 remoting.ClientPluginImpl.prototype.setClipboardHandler = function(handler) {
163 this.updateClipboardData_ = handler;
164 };
165
166 /**
171 * @param {?function({rects:Array<Array<number>>}):void} handler 167 * @param {?function({rects:Array<Array<number>>}):void} handler
172 */ 168 */
173 remoting.ClientPluginImpl.prototype.setDebugDirtyRegionHandler = 169 remoting.ClientPluginImpl.prototype.setDebugDirtyRegionHandler =
174 function(handler) { 170 function(handler) {
175 this.debugRegionHandler_ = handler; 171 this.debugRegionHandler_ = handler;
176 this.plugin_.postMessage(JSON.stringify( 172 this.plugin_.postMessage(JSON.stringify(
177 { method: 'enableDebugRegion', data: { enable: handler != null } })); 173 { method: 'enableDebugRegion', data: { enable: handler != null } }));
178 }; 174 };
179 175
180 /** 176 /**
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 base.getNumberAttr(message.data, 'encodeLatency'); 299 base.getNumberAttr(message.data, 'encodeLatency');
304 base.getNumberAttr(message.data, 'decodeLatency'); 300 base.getNumberAttr(message.data, 'decodeLatency');
305 base.getNumberAttr(message.data, 'renderLatency'); 301 base.getNumberAttr(message.data, 'renderLatency');
306 base.getNumberAttr(message.data, 'roundtripLatency'); 302 base.getNumberAttr(message.data, 'roundtripLatency');
307 this.perfStats_ = 303 this.perfStats_ =
308 /** @type {remoting.ClientSession.PerfStats} */ (message.data); 304 /** @type {remoting.ClientSession.PerfStats} */ (message.data);
309 305
310 } else if (message.method == 'injectClipboardItem') { 306 } else if (message.method == 'injectClipboardItem') {
311 var mimetype = base.getStringAttr(message.data, 'mimeType'); 307 var mimetype = base.getStringAttr(message.data, 'mimeType');
312 var item = base.getStringAttr(message.data, 'item'); 308 var item = base.getStringAttr(message.data, 'item');
313 if (remoting.clipboard) { 309 this.updateClipboardData_(mimetype, item);
314 remoting.clipboard.fromHost(mimetype, item);
315 }
316 310
317 } else if (message.method == 'onFirstFrameReceived') { 311 } else if (message.method == 'onFirstFrameReceived') {
318 if (remoting.clientSession) { 312 if (remoting.clientSession) {
319 remoting.clientSession.onFirstFrameReceived(); 313 remoting.clientSession.onFirstFrameReceived();
320 } 314 }
321 315
322 } else if (message.method == 'fetchPin') { 316 } else if (message.method == 'fetchPin') {
323 // The pairingSupported value in the dictionary indicates whether both 317 // The pairingSupported value in the dictionary indicates whether both
324 // client and host support pairing. If the client doesn't support pairing, 318 // client and host support pairing. If the client doesn't support pairing,
325 // then the value won't be there at all, so give it a default of false. 319 // then the value won't be there at all, so give it a default of false.
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 remoting.DefaultClientPluginFactory.prototype.preloadPlugin = function() { 867 remoting.DefaultClientPluginFactory.prototype.preloadPlugin = function() {
874 if (remoting.settings.CLIENT_PLUGIN_TYPE != 'pnacl') { 868 if (remoting.settings.CLIENT_PLUGIN_TYPE != 'pnacl') {
875 return; 869 return;
876 } 870 }
877 871
878 var plugin = remoting.ClientPluginImpl.createPluginElement_(); 872 var plugin = remoting.ClientPluginImpl.createPluginElement_();
879 plugin.addEventListener( 873 plugin.addEventListener(
880 'loadend', function() { document.body.removeChild(plugin); }, false); 874 'loadend', function() { document.body.removeChild(plugin); }, false);
881 document.body.appendChild(plugin); 875 document.body.appendChild(plugin);
882 }; 876 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698