| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file adheres to closure-compiler conventions in order to enable | 5 // This file adheres to closure-compiler conventions in order to enable |
| 6 // compilation with ADVANCED_OPTIMIZATIONS. See http://goo.gl/FwOgy | 6 // compilation with ADVANCED_OPTIMIZATIONS. See http://goo.gl/FwOgy |
| 7 // | 7 // |
| 8 // Installs and runs the plugin placeholder function on the |__gCrWeb| object. | 8 // Installs and runs the plugin placeholder function on the |__gCrWeb| object. |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 (pluginHeight > windowHeight * significantFraction && | 121 (pluginHeight > windowHeight * significantFraction && |
| 122 pluginWidth > minSize); | 122 pluginWidth > minSize); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * Walks the list of detected plugin elements, adding a placeholder to any | 126 * Walks the list of detected plugin elements, adding a placeholder to any |
| 127 * that are "significant" (see above). | 127 * that are "significant" (see above). |
| 128 * @param {string} message The message to show in the placeholder. | 128 * @param {string} message The message to show in the placeholder. |
| 129 */ | 129 */ |
| 130 __gCrWeb['plugin']['addPluginPlaceholders'] = function(message) { | 130 __gCrWeb['plugin']['addPluginPlaceholders'] = function(message) { |
| 131 var plugins = __gCrWeb['placeholderTargetPlugins']; | 131 var i, plugins = __gCrWeb['placeholderTargetPlugins']; |
| 132 for (i = 0; i < plugins.length; i++) { | 132 for (i = 0; i < plugins.length; i++) { |
| 133 var plugin = plugins[i]; | 133 var plugin = plugins[i]; |
| 134 if (!__gCrWeb['plugin'].isSignificantPlugin_(plugin)) { | 134 if (!__gCrWeb['plugin'].isSignificantPlugin_(plugin)) { |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 | 137 |
| 138 var pluginSize = __gCrWeb['plugin'].getPluginSize_(plugin); | 138 var pluginSize = __gCrWeb['plugin'].getPluginSize_(plugin); |
| 139 var widthStyle = pluginSize.width + 'px'; | 139 var widthStyle = pluginSize.width + 'px'; |
| 140 var heightStyle = pluginSize.height + 'px'; | 140 var heightStyle = pluginSize.height + 'px'; |
| 141 | 141 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 label.style.marginTop = imageSize + 'px'; | 190 label.style.marginTop = imageSize + 'px'; |
| 191 // Center horizontally. | 191 // Center horizontally. |
| 192 label.style.textAlign = 'center'; | 192 label.style.textAlign = 'center'; |
| 193 label.textContent = message; | 193 label.textContent = message; |
| 194 placeholderBox.appendChild(label); | 194 placeholderBox.appendChild(label); |
| 195 | 195 |
| 196 plugin.insertBefore(placeholder, plugin.firstChild); | 196 plugin.insertBefore(placeholder, plugin.firstChild); |
| 197 } | 197 } |
| 198 }; | 198 }; |
| 199 }()); // End of anonymous object | 199 }()); // End of anonymous object |
| OLD | NEW |