| 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
|
|
|