| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 /** @param {string} iq The Iq stanza received from the host. */ | 32 /** @param {string} iq The Iq stanza received from the host. */ |
| 33 this.onOutgoingIqHandler = function (iq) {}; | 33 this.onOutgoingIqHandler = function (iq) {}; |
| 34 /** @param {string} message Log message. */ | 34 /** @param {string} message Log message. */ |
| 35 this.onDebugMessageHandler = function (message) {}; | 35 this.onDebugMessageHandler = function (message) {}; |
| 36 /** | 36 /** |
| 37 * @param {number} state The connection state. | 37 * @param {number} state The connection state. |
| 38 * @param {number} error The error code, if any. | 38 * @param {number} error The error code, if any. |
| 39 */ | 39 */ |
| 40 this.onConnectionStatusUpdateHandler = function(state, error) {}; | 40 this.onConnectionStatusUpdateHandler = function(state, error) {}; |
| 41 /** @param {boolean} ready Connection ready state. */ |
| 42 this.onConnectionReadyHandler = function(ready) {}; |
| 41 this.onDesktopSizeUpdateHandler = function () {}; | 43 this.onDesktopSizeUpdateHandler = function () {}; |
| 42 | 44 |
| 43 /** @type {number} */ | 45 /** @type {number} */ |
| 44 this.pluginApiVersion_ = -1; | 46 this.pluginApiVersion_ = -1; |
| 45 /** @type {Array.<string>} */ | 47 /** @type {Array.<string>} */ |
| 46 this.pluginApiFeatures_ = []; | 48 this.pluginApiFeatures_ = []; |
| 47 /** @type {number} */ | 49 /** @type {number} */ |
| 48 this.pluginApiMinVersion_ = -1; | 50 this.pluginApiMinVersion_ = -1; |
| 49 /** @type {boolean} */ | 51 /** @type {boolean} */ |
| 50 this.helloReceived_ = false; | 52 this.helloReceived_ = false; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return; | 191 return; |
| 190 } | 192 } |
| 191 if (remoting.clipboard) { | 193 if (remoting.clipboard) { |
| 192 remoting.clipboard.fromHost(message.data['mimeType'], | 194 remoting.clipboard.fromHost(message.data['mimeType'], |
| 193 message.data['item']); | 195 message.data['item']); |
| 194 } | 196 } |
| 195 } else if (message.method == 'onFirstFrameReceived') { | 197 } else if (message.method == 'onFirstFrameReceived') { |
| 196 if (remoting.clientSession) { | 198 if (remoting.clientSession) { |
| 197 remoting.clientSession.onFirstFrameReceived(); | 199 remoting.clientSession.onFirstFrameReceived(); |
| 198 } | 200 } |
| 201 } else if (message.method == 'onConnectionReady') { |
| 202 if (typeof message.data['ready'] != 'boolean') { |
| 203 console.error('Received incorrect onConnectionReady message.'); |
| 204 return; |
| 205 } |
| 206 this.onConnectionReadyHandler(message.data['ready']); |
| 199 } | 207 } |
| 200 } | 208 } |
| 201 | 209 |
| 202 /** | 210 /** |
| 203 * Deletes the plugin. | 211 * Deletes the plugin. |
| 204 */ | 212 */ |
| 205 remoting.ClientPluginAsync.prototype.cleanup = function() { | 213 remoting.ClientPluginAsync.prototype.cleanup = function() { |
| 206 this.plugin.parentNode.removeChild(this.plugin); | 214 this.plugin.parentNode.removeChild(this.plugin); |
| 207 }; | 215 }; |
| 208 | 216 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 this.plugin.width = width; | 410 this.plugin.width = width; |
| 403 this.plugin.height = height; | 411 this.plugin.height = height; |
| 404 // Center the plugin just underneath the "Connnecting..." dialog. | 412 // Center the plugin just underneath the "Connnecting..." dialog. |
| 405 var parentNode = this.plugin.parentNode; | 413 var parentNode = this.plugin.parentNode; |
| 406 var dialog = document.getElementById('client-dialog'); | 414 var dialog = document.getElementById('client-dialog'); |
| 407 var dialogRect = dialog.getBoundingClientRect(); | 415 var dialogRect = dialog.getBoundingClientRect(); |
| 408 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; | 416 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; |
| 409 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; | 417 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; |
| 410 } | 418 } |
| 411 }; | 419 }; |
| OLD | NEW |