Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: components/plugins/renderer/loadable_plugin_placeholder.h

Issue 866173002: Plugin Power Saver: Add UI Overlay to throttled plugin using placeholder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/plugins/renderer/loadable_plugin_placeholder.h
diff --git a/components/plugins/renderer/loadable_plugin_placeholder.h b/components/plugins/renderer/loadable_plugin_placeholder.h
index 402fdc7e4d185b976f4d1fe19239e21284e505dc..401ec7d2995e8b03cc4759c0b12ad96ed61aca2b 100644
--- a/components/plugins/renderer/loadable_plugin_placeholder.h
+++ b/components/plugins/renderer/loadable_plugin_placeholder.h
@@ -13,7 +13,9 @@
namespace plugins {
// Placeholders can be used if a plug-in is missing or not available
// (blocked or disabled).
-class LoadablePluginPlaceholder : public PluginPlaceholder {
+class LoadablePluginPlaceholder
+ : public PluginPlaceholder,
+ public content::PluginInstanceThrottler::Observer {
public:
void set_blocked_for_background_tab(bool blocked_for_background_tab) {
is_blocked_for_background_tab_ = blocked_for_background_tab;
@@ -34,6 +36,10 @@ class LoadablePluginPlaceholder : public PluginPlaceholder {
void set_allow_loading(bool allow_loading) { allow_loading_ = allow_loading; }
+ // When we load the plugin, use this already-created plugin, not a new one.
+ void SetPremadePlugin(blink::WebPlugin* plugin,
+ content::PluginInstanceThrottler* throttler);
+
protected:
LoadablePluginPlaceholder(content::RenderFrame* render_frame,
blink::WebLocalFrame* frame,
@@ -73,11 +79,14 @@ class LoadablePluginPlaceholder : public PluginPlaceholder {
private:
// WebViewPlugin::Delegate methods:
- void ShowContextMenu(const blink::WebMouseEvent&) override;
+ void PluginDestroyed() override;
// RenderFrameObserver methods:
void WasShown() override;
+ // content::PluginInstanceThrottler::Observer methods:
+ void OnThrottleStateChange() override;
+
// Javascript callbacks:
// Load the blocked plugin by calling LoadPlugin().
@@ -110,6 +119,10 @@ class LoadablePluginPlaceholder : public PluginPlaceholder {
// This is independent of deferred plugin load due to a Power Saver poster.
content::PluginPowerSaverMode power_saver_mode_;
+ // When we load, uses this premade plugin instead of creating a new one.
+ blink::WebPlugin* premade_plugin_;
+ content::PluginInstanceThrottler* premade_throttler_;
+
bool allow_loading_;
// True if the placeholder was replaced with the real plugin.
« no previous file with comments | « chrome/renderer/resources/plugin_poster.html ('k') | components/plugins/renderer/loadable_plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698