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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 * @return {!Array.<string>} List of words. | 162 * @return {!Array.<string>} List of words. |
163 */ | 163 */ |
164 var tokenize = function(str) { | 164 var tokenize = function(str) { |
165 /** @type {Array.<string>} */ | 165 /** @type {Array.<string>} */ |
166 var tokens = str.match(/\S+/g); | 166 var tokens = str.match(/\S+/g); |
167 return tokens ? tokens : []; | 167 return tokens ? tokens : []; |
168 }; | 168 }; |
169 | 169 |
170 if (message.method == 'hello') { | 170 if (message.method == 'hello') { |
171 // Reset the size in case we had to enlarge it to support click-to-play. | 171 // Reset the size in case we had to enlarge it to support click-to-play. |
172 this.plugin.width = 0; | 172 this.plugin.style.width = '0px'; |
173 this.plugin.height = 0; | 173 this.plugin.style.height = '0px'; |
174 this.pluginApiVersion_ = getNumberAttr(message.data, 'apiVersion'); | 174 this.pluginApiVersion_ = getNumberAttr(message.data, 'apiVersion'); |
175 this.pluginApiMinVersion_ = getNumberAttr(message.data, 'apiMinVersion'); | 175 this.pluginApiMinVersion_ = getNumberAttr(message.data, 'apiMinVersion'); |
176 | 176 |
177 if (this.pluginApiVersion_ >= 7) { | 177 if (this.pluginApiVersion_ >= 7) { |
178 this.pluginApiFeatures_ = | 178 this.pluginApiFeatures_ = |
179 tokenize(getStringAttr(message.data, 'apiFeatures')); | 179 tokenize(getStringAttr(message.data, 'apiFeatures')); |
180 | 180 |
181 // Negotiate capabilities. | 181 // Negotiate capabilities. |
182 | 182 |
183 /** @type {!Array.<string>} */ | 183 /** @type {!Array.<string>} */ |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 /** | 653 /** |
654 * If we haven't yet received a "hello" message from the plugin, change its | 654 * If we haven't yet received a "hello" message from the plugin, change its |
655 * size so that the user can confirm it if click-to-play is enabled, or can | 655 * size so that the user can confirm it if click-to-play is enabled, or can |
656 * see the "this plugin is disabled" message if it is actually disabled. | 656 * see the "this plugin is disabled" message if it is actually disabled. |
657 * @private | 657 * @private |
658 */ | 658 */ |
659 remoting.ClientPlugin.prototype.showPluginForClickToPlay_ = function() { | 659 remoting.ClientPlugin.prototype.showPluginForClickToPlay_ = function() { |
660 if (!this.helloReceived_) { | 660 if (!this.helloReceived_) { |
661 var width = 200; | 661 var width = 200; |
662 var height = 200; | 662 var height = 200; |
663 this.plugin.width = width; | 663 this.plugin.style.width = width + 'px'; |
664 this.plugin.height = height; | 664 this.plugin.style.height = height + 'px'; |
665 // Center the plugin just underneath the "Connnecting..." dialog. | 665 // Center the plugin just underneath the "Connnecting..." dialog. |
666 var parentNode = this.plugin.parentNode; | 666 var parentNode = this.plugin.parentNode; |
667 var dialog = document.getElementById('client-dialog'); | 667 var dialog = document.getElementById('client-dialog'); |
668 var dialogRect = dialog.getBoundingClientRect(); | 668 var dialogRect = dialog.getBoundingClientRect(); |
669 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; | 669 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; |
670 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; | 670 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; |
671 } | 671 } |
672 }; | 672 }; |
OLD | NEW |