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 24 matching lines...) Expand all Loading... |
35 * @constructor | 35 * @constructor |
36 * @implements {remoting.ClientPlugin} | 36 * @implements {remoting.ClientPlugin} |
37 */ | 37 */ |
38 remoting.ClientPluginImpl = function(container, onExtensionMessage, | 38 remoting.ClientPluginImpl = function(container, onExtensionMessage, |
39 requiredCapabilities) { | 39 requiredCapabilities) { |
40 this.plugin_ = remoting.ClientPluginImpl.createPluginElement_(); | 40 this.plugin_ = remoting.ClientPluginImpl.createPluginElement_(); |
41 this.plugin_.id = 'session-client-plugin'; | 41 this.plugin_.id = 'session-client-plugin'; |
42 container.appendChild(this.plugin_); | 42 container.appendChild(this.plugin_); |
43 | 43 |
44 this.onExtensionMessage_ = onExtensionMessage; | 44 this.onExtensionMessage_ = onExtensionMessage; |
45 /** | 45 /** @private {Array<string>} */ |
46 * @type {Array<string>} | |
47 * @private | |
48 */ | |
49 this.requiredCapabilities_ = requiredCapabilities; | 46 this.requiredCapabilities_ = requiredCapabilities; |
50 | 47 |
51 /** | 48 /** |
52 * @param {string} iq The Iq stanza received from the host. | 49 * @param {string} iq The Iq stanza received from the host. |
53 * @private | 50 * @private |
54 */ | 51 */ |
55 this.onOutgoingIqHandler_ = function (iq) {}; | 52 this.onOutgoingIqHandler_ = function (iq) {}; |
56 /** | 53 /** |
57 * @param {string} message Log message. | 54 * @param {string} message Log message. |
58 * @private | 55 * @private |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 */ | 92 */ |
96 this.updateMouseCursorImage_ = function(url, hotspotX, hotspotY) {}; | 93 this.updateMouseCursorImage_ = function(url, hotspotX, hotspotY) {}; |
97 /** | 94 /** |
98 * @param {string} data Remote cast extension message. | 95 * @param {string} data Remote cast extension message. |
99 * @private | 96 * @private |
100 */ | 97 */ |
101 this.onCastExtensionHandler_ = function(data) {}; | 98 this.onCastExtensionHandler_ = function(data) {}; |
102 /** @private {?function({rects:Array<Array<number>>}):void} */ | 99 /** @private {?function({rects:Array<Array<number>>}):void} */ |
103 this.debugRegionHandler_ = null; | 100 this.debugRegionHandler_ = null; |
104 | 101 |
105 /** | 102 /** @private {number} */ |
106 * @type {number} | |
107 * @private | |
108 */ | |
109 this.pluginApiVersion_ = -1; | 103 this.pluginApiVersion_ = -1; |
110 /** | 104 /** @private {Array<string>} */ |
111 * @type {Array<string>} | |
112 * @private | |
113 */ | |
114 this.pluginApiFeatures_ = []; | 105 this.pluginApiFeatures_ = []; |
115 /** | 106 /** @private {number} */ |
116 * @type {number} | |
117 * @private | |
118 */ | |
119 this.pluginApiMinVersion_ = -1; | 107 this.pluginApiMinVersion_ = -1; |
120 /** | 108 /** @private {!Array<string>} */ |
121 * @type {!Array<string>} | |
122 * @private | |
123 */ | |
124 this.capabilities_ = []; | 109 this.capabilities_ = []; |
125 /** | 110 /** @private {boolean} */ |
126 * @type {boolean} | |
127 * @private | |
128 */ | |
129 this.helloReceived_ = false; | 111 this.helloReceived_ = false; |
130 /** | 112 /** @private {function(boolean)|null} */ |
131 * @type {function(boolean)|null} | |
132 * @private | |
133 */ | |
134 this.onInitializedCallback_ = null; | 113 this.onInitializedCallback_ = null; |
135 /** | 114 /** @private {function(string, string):void} */ |
136 * @type {function(string, string):void} | |
137 * @private | |
138 */ | |
139 this.onPairingComplete_ = function(clientId, sharedSecret) {}; | 115 this.onPairingComplete_ = function(clientId, sharedSecret) {}; |
140 /** | 116 /** @private {remoting.ClientSession.PerfStats} */ |
141 * @type {remoting.ClientSession.PerfStats} | |
142 * @private | |
143 */ | |
144 this.perfStats_ = new remoting.ClientSession.PerfStats(); | 117 this.perfStats_ = new remoting.ClientSession.PerfStats(); |
145 | 118 |
146 /** @type {remoting.ClientPluginImpl} */ | 119 /** @type {remoting.ClientPluginImpl} */ |
147 var that = this; | 120 var that = this; |
148 /** @param {Event} event Message event from the plugin. */ | 121 /** @param {Event} event Message event from the plugin. */ |
149 this.plugin_.addEventListener('message', function(event) { | 122 this.plugin_.addEventListener('message', function(event) { |
150 that.handleMessage_( | 123 that.handleMessage_( |
151 /** @type {remoting.ClientPluginMessage} */ (event.data)); | 124 /** @type {remoting.ClientPluginMessage} */ (event.data)); |
152 }, false); | 125 }, false); |
153 | 126 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 remoting.DefaultClientPluginFactory.prototype.preloadPlugin = function() { | 880 remoting.DefaultClientPluginFactory.prototype.preloadPlugin = function() { |
908 if (remoting.settings.CLIENT_PLUGIN_TYPE != 'pnacl') { | 881 if (remoting.settings.CLIENT_PLUGIN_TYPE != 'pnacl') { |
909 return; | 882 return; |
910 } | 883 } |
911 | 884 |
912 var plugin = remoting.ClientPluginImpl.createPluginElement_(); | 885 var plugin = remoting.ClientPluginImpl.createPluginElement_(); |
913 plugin.addEventListener( | 886 plugin.addEventListener( |
914 'loadend', function() { document.body.removeChild(plugin); }, false); | 887 'loadend', function() { document.body.removeChild(plugin); }, false); |
915 document.body.appendChild(plugin); | 888 document.body.appendChild(plugin); |
916 }; | 889 }; |
OLD | NEW |