OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 this.fetchPinHandler = function (supportsPairing) {}; | 57 this.fetchPinHandler = function (supportsPairing) {}; |
58 /** @param {string} data Remote gnubbyd data. */ | 58 /** @param {string} data Remote gnubbyd data. */ |
59 this.onGnubbyAuthHandler = function(data) {}; | 59 this.onGnubbyAuthHandler = function(data) {}; |
60 /** | 60 /** |
61 * @param {string} url | 61 * @param {string} url |
62 * @param {number} hotspotX | 62 * @param {number} hotspotX |
63 * @param {number} hotspotY | 63 * @param {number} hotspotY |
64 */ | 64 */ |
65 this.updateMouseCursorImage = function(url, hotspotX, hotspotY) {}; | 65 this.updateMouseCursorImage = function(url, hotspotX, hotspotY) {}; |
66 | 66 |
| 67 /** @param {string} data Remote cast extension message. */ |
| 68 this.onCastExtensionHandler = function(data) {}; |
| 69 |
67 /** @type {remoting.MediaSourceRenderer} */ | 70 /** @type {remoting.MediaSourceRenderer} */ |
68 this.mediaSourceRenderer_ = null; | 71 this.mediaSourceRenderer_ = null; |
69 | 72 |
70 /** @type {number} */ | 73 /** @type {number} */ |
71 this.pluginApiVersion_ = -1; | 74 this.pluginApiVersion_ = -1; |
72 /** @type {Array.<string>} */ | 75 /** @type {Array.<string>} */ |
73 this.pluginApiFeatures_ = []; | 76 this.pluginApiFeatures_ = []; |
74 /** @type {number} */ | 77 /** @type {number} */ |
75 this.pluginApiMinVersion_ = -1; | 78 this.pluginApiMinVersion_ = -1; |
76 /** @type {!Array.<string>} */ | 79 /** @type {!Array.<string>} */ |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION); | 217 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION); |
215 | 218 |
216 // Let the host know that we're interested in knowing whether or not | 219 // Let the host know that we're interested in knowing whether or not |
217 // it rate-limits desktop-resize requests. | 220 // it rate-limits desktop-resize requests. |
218 this.capabilities_.push( | 221 this.capabilities_.push( |
219 remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS); | 222 remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS); |
220 | 223 |
221 // Let the host know that we can use the video framerecording extension. | 224 // Let the host know that we can use the video framerecording extension. |
222 this.capabilities_.push( | 225 this.capabilities_.push( |
223 remoting.ClientSession.Capability.VIDEO_RECORDER); | 226 remoting.ClientSession.Capability.VIDEO_RECORDER); |
| 227 |
| 228 // Let the host know that we can support casting of the screen. |
| 229 // TODO(aiguha): Add this capability based on a gyp/command-line flag, |
| 230 // rather than by default. |
| 231 this.capabilities_.push( |
| 232 remoting.ClientSession.Capability.CAST); |
| 233 |
224 } else if (this.pluginApiVersion_ >= 6) { | 234 } else if (this.pluginApiVersion_ >= 6) { |
225 this.pluginApiFeatures_ = ['highQualityScaling', 'injectKeyEvent']; | 235 this.pluginApiFeatures_ = ['highQualityScaling', 'injectKeyEvent']; |
226 } else { | 236 } else { |
227 this.pluginApiFeatures_ = ['highQualityScaling']; | 237 this.pluginApiFeatures_ = ['highQualityScaling']; |
228 } | 238 } |
229 this.helloReceived_ = true; | 239 this.helloReceived_ = true; |
230 if (this.onInitializedCallback_ != null) { | 240 if (this.onInitializedCallback_ != null) { |
231 this.onInitializedCallback_(true); | 241 this.onInitializedCallback_(true); |
232 this.onInitializedCallback_ = null; | 242 this.onInitializedCallback_ = null; |
233 } | 243 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } else if (message.method == 'extensionMessage') { | 318 } else if (message.method == 'extensionMessage') { |
309 var extMsgType = getStringAttr(message.data, 'type'); | 319 var extMsgType = getStringAttr(message.data, 'type'); |
310 var extMsgData = getStringAttr(message.data, 'data'); | 320 var extMsgData = getStringAttr(message.data, 'data'); |
311 switch (extMsgType) { | 321 switch (extMsgType) { |
312 case 'gnubby-auth': | 322 case 'gnubby-auth': |
313 this.onGnubbyAuthHandler(extMsgData); | 323 this.onGnubbyAuthHandler(extMsgData); |
314 break; | 324 break; |
315 case 'test-echo-reply': | 325 case 'test-echo-reply': |
316 console.log('Got echo reply: ' + extMsgData); | 326 console.log('Got echo reply: ' + extMsgData); |
317 break; | 327 break; |
| 328 case 'cast_message': |
| 329 this.onCastExtensionHandler(extMsgData); |
| 330 break; |
318 default: | 331 default: |
319 if (!this.onExtensionMessage_(extMsgType, extMsgData)) { | 332 if (!this.onExtensionMessage_(extMsgType, extMsgData)) { |
320 console.log('Unexpected message received: ' + | 333 console.log('Unexpected message received: ' + |
321 extMsgType + ': ' + extMsgData); | 334 extMsgType + ': ' + extMsgData); |
322 } | 335 } |
323 } | 336 } |
324 | 337 |
325 } else if (message.method == 'mediaSourceReset') { | 338 } else if (message.method == 'mediaSourceReset') { |
326 if (!this.mediaSourceRenderer_) { | 339 if (!this.mediaSourceRenderer_) { |
327 console.error('Unexpected mediaSourceReset.'); | 340 console.error('Unexpected mediaSourceReset.'); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 * Undo the CSS rules needed to make the plugin clickable for click-to-play. | 772 * Undo the CSS rules needed to make the plugin clickable for click-to-play. |
760 * @private | 773 * @private |
761 */ | 774 */ |
762 remoting.ClientPlugin.prototype.hidePluginForClickToPlay_ = function() { | 775 remoting.ClientPlugin.prototype.hidePluginForClickToPlay_ = function() { |
763 this.plugin.style.width = ''; | 776 this.plugin.style.width = ''; |
764 this.plugin.style.height = ''; | 777 this.plugin.style.height = ''; |
765 this.plugin.style.top = ''; | 778 this.plugin.style.top = ''; |
766 this.plugin.style.left = ''; | 779 this.plugin.style.left = ''; |
767 this.plugin.style.position = ''; | 780 this.plugin.style.position = ''; |
768 }; | 781 }; |
OLD | NEW |