OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BLOCKED_PLUGIN_H_ |
6 #define CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 6 #define CHROME_RENDERER_BLOCKED_PLUGIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/common/notification_observer.h" | 9 #include "chrome/common/notification_observer.h" |
10 #include "chrome/common/notification_registrar.h" | 10 #include "chrome/common/notification_registrar.h" |
| 11 #include "chrome/renderer/custom_menu_listener.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" |
12 #include "webkit/glue/cpp_bound_class.h" | 13 #include "webkit/glue/cpp_bound_class.h" |
13 #include "webkit/glue/plugins/webview_plugin.h" | 14 #include "webkit/glue/plugins/webview_plugin.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 class PluginGroup; | 17 class PluginGroup; |
17 class RenderView; | 18 class RenderView; |
18 | 19 |
19 class BlockedPlugin : public CppBoundClass, | 20 class BlockedPlugin : public CppBoundClass, |
20 public WebViewPlugin::Delegate, | 21 public WebViewPlugin::Delegate, |
21 public NotificationObserver { | 22 public NotificationObserver, |
| 23 public CustomMenuListener { |
22 public: | 24 public: |
23 BlockedPlugin(RenderView* render_view, | 25 BlockedPlugin(RenderView* render_view, |
24 WebKit::WebFrame* frame, | 26 WebKit::WebFrame* frame, |
25 const PluginGroup& info, | 27 const PluginGroup& info, |
26 const WebKit::WebPluginParams& params, | 28 const WebKit::WebPluginParams& params, |
27 const WebPreferences& settings, | 29 const WebPreferences& settings, |
28 int template_id, | 30 int template_id, |
29 const string16& message); | 31 const string16& message); |
30 | 32 |
31 WebViewPlugin* plugin() { return plugin_; } | 33 WebViewPlugin* plugin() { return plugin_; } |
32 | 34 |
33 // WebViewPlugin::Delegate methods: | 35 // WebViewPlugin::Delegate methods: |
34 virtual void BindWebFrame(WebKit::WebFrame* frame); | 36 virtual void BindWebFrame(WebKit::WebFrame* frame); |
35 virtual void WillDestroyPlugin(); | 37 virtual void WillDestroyPlugin(); |
| 38 virtual void ShowContextMenu(const WebKit::WebMouseEvent&); |
36 | 39 |
37 // NotificationObserver methods: | 40 // NotificationObserver methods: |
38 virtual void Observe(NotificationType type, | 41 virtual void Observe(NotificationType type, |
39 const NotificationSource& source, | 42 const NotificationSource& source, |
40 const NotificationDetails& details); | 43 const NotificationDetails& details); |
41 | 44 |
| 45 // CustomMenuListener methods: |
| 46 virtual void MenuItemSelected(unsigned id); |
| 47 |
42 private: | 48 private: |
43 virtual ~BlockedPlugin(); | 49 virtual ~BlockedPlugin(); |
44 | 50 |
45 // Javascript callbacks: | 51 // Javascript callbacks: |
46 // Load the blocked plugin by calling LoadPlugin() below. | 52 // Load the blocked plugin by calling LoadPlugin() below. |
47 // Takes no arguments, and returns nothing. | 53 // Takes no arguments, and returns nothing. |
48 void Load(const CppArgumentList& args, CppVariant* result); | 54 void Load(const CppArgumentList& args, CppVariant* result); |
49 | 55 |
50 // Load the blocked plugin. | 56 // Load the blocked plugin. |
51 void LoadPlugin(); | 57 void LoadPlugin(); |
52 | 58 |
| 59 // Hide the blocked plugin. |
| 60 void HidePlugin(); |
| 61 |
53 RenderView* render_view_; | 62 RenderView* render_view_; |
54 WebKit::WebFrame* frame_; | 63 WebKit::WebFrame* frame_; |
55 WebKit::WebPluginParams plugin_params_; | 64 WebKit::WebPluginParams plugin_params_; |
56 WebViewPlugin* plugin_; | 65 WebViewPlugin* plugin_; |
| 66 // The name of the plugin that was blocked. |
| 67 string16 name_; |
57 | 68 |
58 NotificationRegistrar registrar_; | 69 NotificationRegistrar registrar_; |
59 }; | 70 }; |
60 | 71 |
61 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 72 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ |
OLD | NEW |