[Android] Add tests for toolbar of Chrome Custom Tabs
[chromium-blink-merge.git] / components / plugins / renderer / plugin_placeholder.h
blob5d9caa10ee4f33876c7a335d439b14107b12be48
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
6 #define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "components/plugins/renderer/webview_plugin.h"
10 #include "content/public/renderer/render_frame_observer.h"
11 #include "gin/wrappable.h"
12 #include "third_party/WebKit/public/web/WebPluginParams.h"
14 namespace plugins {
16 class PluginPlaceholder : public content::RenderFrameObserver,
17 public WebViewPlugin::Delegate,
18 public gin::Wrappable<PluginPlaceholder> {
19 public:
20 static gin::WrapperInfo kWrapperInfo;
22 WebViewPlugin* plugin() { return plugin_; }
24 protected:
25 // |render_frame| and |frame| are weak pointers. If either one is going away,
26 // our |plugin_| will be destroyed as well and will notify us.
27 PluginPlaceholder(content::RenderFrame* render_frame,
28 blink::WebLocalFrame* frame,
29 const blink::WebPluginParams& params,
30 const std::string& html_data,
31 GURL placeholderDataUrl);
33 ~PluginPlaceholder() override;
35 blink::WebLocalFrame* GetFrame();
36 const blink::WebPluginParams& GetPluginParams() const;
38 // WebViewPlugin::Delegate methods:
39 void ShowContextMenu(const blink::WebMouseEvent&) override;
40 void PluginDestroyed() override;
41 v8::Local<v8::Object> GetV8ScriptableObject(
42 v8::Isolate* isolate) const override;
44 private:
45 // RenderFrameObserver methods:
46 void OnDestruct() override;
48 blink::WebLocalFrame* frame_;
49 blink::WebPluginParams plugin_params_;
50 WebViewPlugin* plugin_;
52 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
55 } // namespace plugins
57 #endif // COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_