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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution', | 97 NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution', |
98 ASYNC_PIN: 'asyncPin', | 98 ASYNC_PIN: 'asyncPin', |
99 PAUSE_VIDEO: 'pauseVideo', | 99 PAUSE_VIDEO: 'pauseVideo', |
100 PAUSE_AUDIO: 'pauseAudio', | 100 PAUSE_AUDIO: 'pauseAudio', |
101 REMAP_KEY: 'remapKey', | 101 REMAP_KEY: 'remapKey', |
102 SEND_CLIPBOARD_ITEM: 'sendClipboardItem', | 102 SEND_CLIPBOARD_ITEM: 'sendClipboardItem', |
103 THIRD_PARTY_AUTH: 'thirdPartyAuth', | 103 THIRD_PARTY_AUTH: 'thirdPartyAuth', |
104 TRAP_KEY: 'trapKey', | 104 TRAP_KEY: 'trapKey', |
105 PINLESS_AUTH: 'pinlessAuth', | 105 PINLESS_AUTH: 'pinlessAuth', |
106 EXTENSION_MESSAGE: 'extensionMessage', | 106 EXTENSION_MESSAGE: 'extensionMessage', |
107 MEDIA_SOURCE_RENDERING: 'mediaSourceRendering' | 107 MEDIA_SOURCE_RENDERING: 'mediaSourceRendering', |
108 VIDEO_CONTROL: 'videoControl', | |
108 }; | 109 }; |
109 | 110 |
110 /** | 111 /** |
111 * Chromoting session API version (for this javascript). | 112 * Chromoting session API version (for this javascript). |
112 * This is compared with the plugin API version to verify that they are | 113 * This is compared with the plugin API version to verify that they are |
113 * compatible. | 114 * compatible. |
114 * | 115 * |
115 * @const | 116 * @const |
116 * @private | 117 * @private |
117 */ | 118 */ |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
541 } | 542 } |
542 }; | 543 }; |
543 | 544 |
544 /** | 545 /** |
545 * Requests that the host pause or resume sending video updates. | 546 * Requests that the host pause or resume sending video updates. |
546 * | 547 * |
547 * @param {boolean} pause True to suspend video updates, false otherwise. | 548 * @param {boolean} pause True to suspend video updates, false otherwise. |
548 */ | 549 */ |
549 remoting.ClientPlugin.prototype.pauseVideo = | 550 remoting.ClientPlugin.prototype.pauseVideo = |
550 function(pause) { | 551 function(pause) { |
551 if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) { | 552 if (this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) { |
552 return; | 553 this.plugin.postMessage(JSON.stringify( |
554 { method: 'videoControl', data: { enable: !pause }})); | |
555 } else if (this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) { | |
556 this.plugin.postMessage(JSON.stringify( | |
557 { method: 'pauseVideo', data: { pause: pause }})); | |
553 } | 558 } |
554 this.plugin.postMessage(JSON.stringify( | |
555 { method: 'pauseVideo', data: { pause: pause }})); | |
556 }; | 559 }; |
557 | 560 |
558 /** | 561 /** |
559 * Requests that the host pause or resume sending audio updates. | 562 * Requests that the host pause or resume sending audio updates. |
560 * | 563 * |
561 * @param {boolean} pause True to suspend audio updates, false otherwise. | 564 * @param {boolean} pause True to suspend audio updates, false otherwise. |
562 */ | 565 */ |
563 remoting.ClientPlugin.prototype.pauseAudio = | 566 remoting.ClientPlugin.prototype.pauseAudio = |
564 function(pause) { | 567 function(pause) { |
565 if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_AUDIO)) { | 568 if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_AUDIO)) { |
566 return; | 569 return; |
567 } | 570 } |
568 this.plugin.postMessage(JSON.stringify( | 571 this.plugin.postMessage(JSON.stringify( |
569 { method: 'pauseAudio', data: { pause: pause }})); | 572 { method: 'pauseAudio', data: { pause: pause }})); |
570 }; | 573 }; |
571 | 574 |
572 /** | 575 /** |
576 * Requests that the host configure the video codec for lossless encode. | |
577 * | |
578 * @param {boolean} want_lossless True to request lossless encoding. | |
Jamie
2014/05/28 22:21:19
Nit: camelCase :)
Wez
2014/05/28 22:41:07
Done.
| |
579 */ | |
580 remoting.ClientPlugin.prototype.setLosslessEncode = | |
581 function(want_lossless) { | |
582 if (!this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) { | |
583 return; | |
584 } | |
585 this.plugin.postMessage(JSON.stringify( | |
586 { method: 'videoControl', data: { lossless_encode: want_lossless }})); | |
Jamie
2014/05/28 22:21:19
Nit: Quotes around dictionary keys, for consistenc
Wez
2014/05/28 22:41:07
Not sure what you mean; this file consistently _do
Jamie
2014/05/28 22:53:56
My mistake. I was reading 'videoControl' as a key
| |
587 }; | |
588 | |
589 /** | |
590 * Requests that the host configure the video codec for lossless color. | |
591 * | |
592 * @param {boolean} want_lossless True to request lossless color. | |
593 */ | |
594 remoting.ClientPlugin.prototype.setLosslessColor = | |
595 function(want_lossless) { | |
596 if (!this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) { | |
597 return; | |
598 } | |
599 this.plugin.postMessage(JSON.stringify( | |
600 { method: 'videoControl', data: { lossless_color: want_lossless }})); | |
601 }; | |
602 | |
603 /** | |
573 * Called when a PIN is obtained from the user. | 604 * Called when a PIN is obtained from the user. |
574 * | 605 * |
575 * @param {string} pin The PIN. | 606 * @param {string} pin The PIN. |
576 */ | 607 */ |
577 remoting.ClientPlugin.prototype.onPinFetched = | 608 remoting.ClientPlugin.prototype.onPinFetched = |
578 function(pin) { | 609 function(pin) { |
579 if (!this.hasFeature(remoting.ClientPlugin.Feature.ASYNC_PIN)) { | 610 if (!this.hasFeature(remoting.ClientPlugin.Feature.ASYNC_PIN)) { |
580 return; | 611 return; |
581 } | 612 } |
582 this.plugin.postMessage(JSON.stringify( | 613 this.plugin.postMessage(JSON.stringify( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
670 this.plugin.style.width = width + 'px'; | 701 this.plugin.style.width = width + 'px'; |
671 this.plugin.style.height = height + 'px'; | 702 this.plugin.style.height = height + 'px'; |
672 // Center the plugin just underneath the "Connnecting..." dialog. | 703 // Center the plugin just underneath the "Connnecting..." dialog. |
673 var parentNode = this.plugin.parentNode; | 704 var parentNode = this.plugin.parentNode; |
674 var dialog = document.getElementById('client-dialog'); | 705 var dialog = document.getElementById('client-dialog'); |
675 var dialogRect = dialog.getBoundingClientRect(); | 706 var dialogRect = dialog.getBoundingClientRect(); |
676 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; | 707 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; |
677 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; | 708 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; |
678 } | 709 } |
679 }; | 710 }; |
OLD | NEW |