OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_BLOCKED_PLUGIN_H_ |
6 #define CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 6 #define CHROME_RENDERER_PLUGINS_BLOCKED_PLUGIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "content/public/renderer/render_view_observer.h" | 9 #include "chrome/renderer/plugins/plugin_placeholder.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | |
11 #include "webkit/glue/cpp_bound_class.h" | |
12 #include "webkit/plugins/npapi/webview_plugin.h" | |
13 #include "webkit/plugins/webplugininfo.h" | 10 #include "webkit/plugins/webplugininfo.h" |
14 | 11 |
15 class BlockedPlugin : public content::RenderViewObserver, | 12 namespace webkit { |
16 public CppBoundClass, | 13 namespace npapi { |
17 public webkit::npapi::WebViewPlugin::Delegate { | 14 class PluginGroup; |
15 } | |
16 } | |
17 | |
18 class BlockedPlugin : public PluginPlaceholder { | |
18 public: | 19 public: |
20 static webkit::npapi::WebViewPlugin* Create( | |
battre
2011/11/22 09:57:15
Document owernship of passed pointers?
| |
21 content::RenderView* render_view, | |
22 WebKit::WebFrame* frame, | |
23 const WebKit::WebPluginParams& params, | |
24 const webkit::WebPluginInfo& info, | |
25 const webkit::npapi::PluginGroup* group, | |
26 int resource_id, | |
27 int message_id, | |
28 bool is_blocked_for_prerendering, | |
29 bool allow_loading); | |
30 | |
31 private: | |
19 BlockedPlugin(content::RenderView* render_view, | 32 BlockedPlugin(content::RenderView* render_view, |
20 WebKit::WebFrame* frame, | 33 WebKit::WebFrame* frame, |
34 const WebKit::WebPluginParams& params, | |
35 const std::string& html_data, | |
21 const webkit::WebPluginInfo& info, | 36 const webkit::WebPluginInfo& info, |
22 const WebKit::WebPluginParams& params, | |
23 const WebPreferences& settings, | |
24 int template_id, | |
25 const string16& name, | 37 const string16& name, |
26 const string16& message, | |
27 bool is_blocked_for_prerendering, | 38 bool is_blocked_for_prerendering, |
28 bool allow_loading); | 39 bool allow_loading); |
29 | 40 virtual ~BlockedPlugin(); |
30 webkit::npapi::WebViewPlugin* plugin() { return plugin_; } | |
31 | 41 |
32 // WebViewPlugin::Delegate methods: | 42 // WebViewPlugin::Delegate methods: |
33 virtual void BindWebFrame(WebKit::WebFrame* frame); | 43 virtual void BindWebFrame(WebKit::WebFrame* frame); |
34 virtual void WillDestroyPlugin(); | |
35 virtual void ShowContextMenu(const WebKit::WebMouseEvent&); | 44 virtual void ShowContextMenu(const WebKit::WebMouseEvent&); |
36 | 45 |
37 private: | |
38 virtual ~BlockedPlugin(); | |
39 | |
40 // RenderViewObserver methods: | 46 // RenderViewObserver methods: |
41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
42 virtual void ContextMenuAction(unsigned id) OVERRIDE; | 48 virtual void ContextMenuAction(unsigned id) OVERRIDE; |
43 | 49 |
44 void OnLoadBlockedPlugins(); | 50 void OnLoadBlockedPlugins(); |
45 void OnSetIsPrerendering(bool is_prerendering); | 51 void OnSetIsPrerendering(bool is_prerendering); |
46 | 52 |
47 // Javascript callbacks: | 53 // Javascript callbacks: |
48 // Load the blocked plugin by calling LoadPlugin(). | 54 // Load the blocked plugin by calling LoadPlugin(). |
49 // Takes no arguments, and returns nothing. | 55 // Takes no arguments, and returns nothing. |
50 void LoadCallback(const CppArgumentList& args, CppVariant* result); | 56 void LoadCallback(const CppArgumentList& args, CppVariant* result); |
51 | 57 |
52 // Hide the blocked plugin by calling HidePlugin(). | 58 // Hide the blocked plugin by calling HidePlugin(). |
53 // Takes no arguments, and returns nothing. | 59 // Takes no arguments, and returns nothing. |
54 void HideCallback(const CppArgumentList& args, CppVariant* result); | 60 void HideCallback(const CppArgumentList& args, CppVariant* result); |
55 | 61 |
56 // Opens a URL in a new tab. | 62 // Opens a URL in a new tab. |
57 // Takes one argument, a string specifying the URL to open. Returns nothing. | 63 // Takes one argument, a string specifying the URL to open. Returns nothing. |
58 void OpenUrlCallback(const CppArgumentList& args, CppVariant* result); | 64 void OpenUrlCallback(const CppArgumentList& args, CppVariant* result); |
59 | 65 |
60 // Load the blocked plugin. | 66 // Load the blocked plugin. |
61 void LoadPlugin(); | 67 void LoadPlugin(); |
62 | 68 |
63 // Hide the blocked plugin. | 69 // Hide the blocked plugin. |
64 void HidePlugin(); | 70 void HidePlugin(); |
65 | 71 |
66 WebKit::WebFrame* frame_; | |
67 webkit::WebPluginInfo plugin_info_; | 72 webkit::WebPluginInfo plugin_info_; |
68 WebKit::WebPluginParams plugin_params_; | |
69 webkit::npapi::WebViewPlugin* plugin_; | |
70 // The name of the plugin that was blocked. | 73 // The name of the plugin that was blocked. |
71 string16 name_; | 74 string16 name_; |
72 // True iff the plugin was blocked because the page was being prerendered. | 75 // True iff the plugin was blocked because the page was being prerendered. |
73 // Plugin will automatically be loaded when the page is displayed. | 76 // Plugin will automatically be loaded when the page is displayed. |
74 bool is_blocked_for_prerendering_; | 77 bool is_blocked_for_prerendering_; |
75 bool hidden_; | 78 bool hidden_; |
76 bool allow_loading_; | 79 bool allow_loading_; |
battre
2011/11/22 09:57:15
DISALLOW_COPY_AND_ASSIGN?
| |
77 }; | 80 }; |
78 | 81 |
79 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 82 #endif // CHROME_RENDERER_PLUGINS_BLOCKED_PLUGIN_H_ |
OLD | NEW |