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

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

Issue 1161923004: Reland: Plugin Placeholders: Refactor for platforms that don't support plugins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove some enable_plugins that are no longer needed Created 5 years, 6 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/plugin_placeholder.h
diff --git a/components/plugins/renderer/plugin_placeholder.h b/components/plugins/renderer/plugin_placeholder.h
index 5d9caa10ee4f33876c7a335d439b14107b12be48..63a1d08c8b1c47c1bca8e3fe87955a37e4bdf93c 100644
--- a/components/plugins/renderer/plugin_placeholder.h
+++ b/components/plugins/renderer/plugin_placeholder.h
@@ -8,30 +8,29 @@
#include "base/memory/weak_ptr.h"
#include "components/plugins/renderer/webview_plugin.h"
#include "content/public/renderer/render_frame_observer.h"
+#include "gin/handle.h"
#include "gin/wrappable.h"
+#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
namespace plugins {
-class PluginPlaceholder : public content::RenderFrameObserver,
- public WebViewPlugin::Delegate,
- public gin::Wrappable<PluginPlaceholder> {
+// This abstract class is the base class of all plugin placeholders.
+class PluginPlaceholderBase : public content::RenderFrameObserver,
+ public WebViewPlugin::Delegate {
public:
- static gin::WrapperInfo kWrapperInfo;
-
- WebViewPlugin* plugin() { return plugin_; }
-
- protected:
// |render_frame| and |frame| are weak pointers. If either one is going away,
// our |plugin_| will be destroyed as well and will notify us.
- PluginPlaceholder(content::RenderFrame* render_frame,
- blink::WebLocalFrame* frame,
- const blink::WebPluginParams& params,
- const std::string& html_data,
- GURL placeholderDataUrl);
+ PluginPlaceholderBase(content::RenderFrame* render_frame,
+ blink::WebLocalFrame* frame,
+ const blink::WebPluginParams& params,
+ const std::string& html_data);
- ~PluginPlaceholder() override;
+ ~PluginPlaceholderBase() override;
+
+ WebViewPlugin* plugin() { return plugin_; }
+ protected:
blink::WebLocalFrame* GetFrame();
const blink::WebPluginParams& GetPluginParams() const;
@@ -41,6 +40,14 @@ class PluginPlaceholder : public content::RenderFrameObserver,
v8::Local<v8::Object> GetV8ScriptableObject(
v8::Isolate* isolate) const override;
+ protected:
+ // Hide this placeholder.
+ void HidePlugin();
+ bool hidden() { return hidden_; }
+
+ // JavaScript callbacks:
+ void HideCallback();
+
private:
// RenderFrameObserver methods:
void OnDestruct() override;
@@ -49,7 +56,30 @@ class PluginPlaceholder : public content::RenderFrameObserver,
blink::WebPluginParams plugin_params_;
WebViewPlugin* plugin_;
- DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
+ bool hidden_;
+
+ DISALLOW_COPY_AND_ASSIGN(PluginPlaceholderBase);
+};
+
+// A basic placeholder that supports only hiding.
+class PluginPlaceholder final : public PluginPlaceholderBase,
+ public gin::Wrappable<PluginPlaceholder> {
+ public:
+ static gin::WrapperInfo kWrapperInfo;
+
+ PluginPlaceholder(content::RenderFrame* render_frame,
+ blink::WebLocalFrame* frame,
+ const blink::WebPluginParams& params,
+ const std::string& html_data);
+ ~PluginPlaceholder() override;
+
+ private:
+ // WebViewPlugin::Delegate methods:
+ v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) final;
+
+ // gin::Wrappable method:
+ gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
+ v8::Isolate* isolate) override;
};
} // namespace plugins
« no previous file with comments | « components/plugins/renderer/mobile_youtube_plugin.cc ('k') | components/plugins/renderer/plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698