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

Side by Side 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: Merge to solve patch conflicts again... 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ 5 #ifndef COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
6 #define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ 6 #define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "components/plugins/renderer/webview_plugin.h" 9 #include "components/plugins/renderer/webview_plugin.h"
10 #include "content/public/renderer/render_frame_observer.h" 10 #include "content/public/renderer/render_frame_observer.h"
11 #include "gin/handle.h"
11 #include "gin/wrappable.h" 12 #include "gin/wrappable.h"
13 #include "third_party/WebKit/public/web/WebKit.h"
12 #include "third_party/WebKit/public/web/WebPluginParams.h" 14 #include "third_party/WebKit/public/web/WebPluginParams.h"
13 15
14 namespace plugins { 16 namespace plugins {
15 17
16 class PluginPlaceholder : public content::RenderFrameObserver, 18 class PluginPlaceholder : public content::RenderFrameObserver,
17 public WebViewPlugin::Delegate, 19 public WebViewPlugin::Delegate,
18 public gin::Wrappable<PluginPlaceholder> { 20 public gin::Wrappable<PluginPlaceholder> {
19 public: 21 public:
20 static gin::WrapperInfo kWrapperInfo; 22 static gin::WrapperInfo kWrapperInfo;
21 23
22 WebViewPlugin* plugin() { return plugin_; }
23
24 protected:
25 // |render_frame| and |frame| are weak pointers. If either one is going away, 24 // |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. 25 // our |plugin_| will be destroyed as well and will notify us.
27 PluginPlaceholder(content::RenderFrame* render_frame, 26 PluginPlaceholder(content::RenderFrame* render_frame,
28 blink::WebLocalFrame* frame, 27 blink::WebLocalFrame* frame,
29 const blink::WebPluginParams& params, 28 const blink::WebPluginParams& params,
30 const std::string& html_data, 29 const std::string& html_data);
31 GURL placeholderDataUrl);
32 30
33 ~PluginPlaceholder() override; 31 ~PluginPlaceholder() override;
34 32
33 WebViewPlugin* plugin() { return plugin_; }
34
35 protected:
35 blink::WebLocalFrame* GetFrame(); 36 blink::WebLocalFrame* GetFrame();
36 const blink::WebPluginParams& GetPluginParams() const; 37 const blink::WebPluginParams& GetPluginParams() const;
37 38
38 // WebViewPlugin::Delegate methods: 39 // WebViewPlugin::Delegate methods:
40 v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override;
39 void ShowContextMenu(const blink::WebMouseEvent&) override; 41 void ShowContextMenu(const blink::WebMouseEvent&) override;
40 void PluginDestroyed() override; 42 void PluginDestroyed() override;
41 v8::Local<v8::Object> GetV8ScriptableObject( 43 v8::Local<v8::Object> GetV8ScriptableObject(
42 v8::Isolate* isolate) const override; 44 v8::Isolate* isolate) const override;
43 45
46 // gin::Wrappable method:
47 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
48 v8::Isolate* isolate) override;
49
50 protected:
51 // Hide this placeholder.
52 void HidePlugin();
53 bool hidden() { return hidden_; }
54
44 private: 55 private:
45 // RenderFrameObserver methods: 56 // RenderFrameObserver methods:
46 void OnDestruct() override; 57 void OnDestruct() override;
47 58
59 // JavaScript callbacks:
60 void HideCallback();
61
48 blink::WebLocalFrame* frame_; 62 blink::WebLocalFrame* frame_;
49 blink::WebPluginParams plugin_params_; 63 blink::WebPluginParams plugin_params_;
50 WebViewPlugin* plugin_; 64 WebViewPlugin* plugin_;
51 65
66 bool hidden_;
67
52 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); 68 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
53 }; 69 };
54 70
55 } // namespace plugins 71 } // namespace plugins
56 72
57 #endif // COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ 73 #endif // COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698