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 | 7 |
| 8 #include "chrome/common/notification_observer.h" |
| 9 #include "chrome/common/notification_registrar.h" |
8 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" |
9 #include "webkit/glue/cpp_bound_class.h" | 11 #include "webkit/glue/cpp_bound_class.h" |
10 #include "webkit/glue/plugins/webview_plugin.h" | 12 #include "webkit/glue/plugins/webview_plugin.h" |
11 | 13 |
| 14 class GURL; |
| 15 class PluginGroup; |
12 class RenderView; | 16 class RenderView; |
13 | 17 |
14 class BlockedPlugin : public CppBoundClass, | 18 class BlockedPlugin : public CppBoundClass, |
15 public WebViewPlugin::Delegate { | 19 public WebViewPlugin::Delegate, |
| 20 public NotificationObserver { |
16 public: | 21 public: |
17 BlockedPlugin(RenderView* render_view, | 22 BlockedPlugin(RenderView* render_view, |
18 WebKit::WebFrame* frame, | 23 WebKit::WebFrame* frame, |
19 const WebKit::WebPluginParams& params); | 24 const WebKit::WebPluginParams& params, |
20 | 25 PluginGroup* group); |
21 void Load(const CppArgumentList& args, CppVariant* result); | |
22 void LoadPlugin(); | |
23 | 26 |
24 WebViewPlugin* plugin() { return plugin_; } | 27 WebViewPlugin* plugin() { return plugin_; } |
25 | 28 |
26 // WebViewPlugin::Delegate methods: | 29 // WebViewPlugin::Delegate methods: |
27 virtual void BindWebFrame(WebKit::WebFrame* frame); | 30 virtual void BindWebFrame(WebKit::WebFrame* frame); |
28 virtual void WillDestroyPlugin(); | 31 virtual void WillDestroyPlugin(); |
29 | 32 |
| 33 // NotificationObserver methods: |
| 34 virtual void Observe(NotificationType type, |
| 35 const NotificationSource& source, |
| 36 const NotificationDetails& details); |
| 37 |
30 private: | 38 private: |
31 virtual ~BlockedPlugin() { } | 39 virtual ~BlockedPlugin() { } |
32 | 40 |
| 41 // Javascript callbacks: |
| 42 // Load the blocked plugin by calling LoadPlugin() below. |
| 43 // Takes no arguments, and returns nothing. |
| 44 void Load(const CppArgumentList& args, CppVariant* result); |
| 45 |
| 46 // Update an outdated plugin. Takes one argument, the URL to download the |
| 47 // latest version, and returns nothing. |
| 48 void Update(const CppArgumentList& args, CppVariant* result); |
| 49 |
| 50 // Tells the browser to navigate to |url| (to download the latest version of |
| 51 // the plugin there). |
| 52 void OpenURL(GURL& url); |
| 53 |
| 54 // Load the blocked plugin. |
| 55 void LoadPlugin(); |
| 56 |
33 RenderView* render_view_; | 57 RenderView* render_view_; |
34 WebKit::WebFrame* frame_; | 58 WebKit::WebFrame* frame_; |
35 WebKit::WebPluginParams plugin_params_; | 59 WebKit::WebPluginParams plugin_params_; |
36 WebViewPlugin* plugin_; | 60 WebViewPlugin* plugin_; |
| 61 |
| 62 NotificationRegistrar registrar_; |
37 }; | 63 }; |
38 | 64 |
39 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 65 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ |
OLD | NEW |