Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc |
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
index c532fdd2c2c7c3e23014a9160373e77cf3429683..402bfb6f3e87fa1701962e94f540962cd2ba6d6e 100644 |
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
@@ -13,6 +13,7 @@ |
#include "chrome/grit/renderer_resources.h" |
#include "chrome/renderer/chrome_content_renderer_client.h" |
#include "chrome/renderer/custom_menu_commands.h" |
+#include "chrome/renderer/plugins/plugin_preroller.h" |
#include "chrome/renderer/plugins/plugin_uma.h" |
#include "components/content_settings/content/common/content_settings_messages.h" |
#include "content/app/strings/grit/content_strings.h" |
@@ -366,6 +367,24 @@ void ChromePluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) { |
#endif // OS_ANDROID |
} |
+blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() { |
+ scoped_ptr<content::PluginInstanceThrottler> throttler; |
+#if defined(ENABLE_PLUGINS) |
+ // If the plugin has already been marked essential in its placeholder form, |
+ // we shouldn't create a new throttler and start the process all over again. |
+ if (power_saver_enabled()) { |
+ throttler = content::PluginInstanceThrottler::Create(); |
+ // PluginPreroller manages its own lifetime. |
+ new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), |
+ GetPluginInfo(), GetIdentifier(), title_, |
+ l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), |
+ throttler.get()); |
+ } |
+#endif |
+ return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), |
+ GetPluginParams(), throttler.Pass()); |
+} |
+ |
gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( |
v8::Isolate* isolate) { |
return LoadablePluginPlaceholder::GetObjectTemplateBuilder(isolate).SetMethod( |