| 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/renderer/render_view_observer.h" | 9 #include "chrome/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
| 11 #include "webkit/glue/cpp_bound_class.h" | 11 #include "webkit/glue/cpp_bound_class.h" |
| 12 #include "webkit/plugins/npapi/webview_plugin.h" | 12 #include "webkit/plugins/npapi/webview_plugin.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace webkit { | 16 namespace webkit { |
| 17 namespace npapi { | 17 namespace npapi { |
| 18 class PluginGroup; | 18 class PluginGroup; |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace webkit_glue { |
| 23 struct CustomContextMenuContext; |
| 24 } |
| 25 |
| 22 class BlockedPlugin : public RenderViewObserver, | 26 class BlockedPlugin : public RenderViewObserver, |
| 23 public CppBoundClass, | 27 public CppBoundClass, |
| 24 public webkit::npapi::WebViewPlugin::Delegate { | 28 public webkit::npapi::WebViewPlugin::Delegate { |
| 25 public: | 29 public: |
| 26 BlockedPlugin(RenderView* render_view, | 30 BlockedPlugin(RenderView* render_view, |
| 27 WebKit::WebFrame* frame, | 31 WebKit::WebFrame* frame, |
| 28 const webkit::npapi::PluginGroup& info, | 32 const webkit::npapi::PluginGroup& info, |
| 29 const WebKit::WebPluginParams& params, | 33 const WebKit::WebPluginParams& params, |
| 30 const WebPreferences& settings, | 34 const WebPreferences& settings, |
| 31 int template_id, | 35 int template_id, |
| 32 const string16& message, | 36 const string16& message, |
| 33 bool is_blocked_for_prerendering); | 37 bool is_blocked_for_prerendering); |
| 34 | 38 |
| 35 webkit::npapi::WebViewPlugin* plugin() { return plugin_; } | 39 webkit::npapi::WebViewPlugin* plugin() { return plugin_; } |
| 36 | 40 |
| 37 // WebViewPlugin::Delegate methods: | 41 // WebViewPlugin::Delegate methods: |
| 38 virtual void BindWebFrame(WebKit::WebFrame* frame); | 42 virtual void BindWebFrame(WebKit::WebFrame* frame); |
| 39 virtual void WillDestroyPlugin(); | 43 virtual void WillDestroyPlugin(); |
| 40 virtual void ShowContextMenu(const WebKit::WebMouseEvent&); | 44 virtual void ShowContextMenu(const WebKit::WebMouseEvent&); |
| 41 | 45 |
| 42 private: | 46 private: |
| 43 virtual ~BlockedPlugin(); | 47 virtual ~BlockedPlugin(); |
| 44 | 48 |
| 45 // RenderViewObserver methods: | 49 // RenderViewObserver methods: |
| 46 virtual bool OnMessageReceived(const IPC::Message& message); | 50 virtual bool OnMessageReceived(const IPC::Message& message); |
| 47 | 51 |
| 48 void OnMenuItemSelected(unsigned id); | 52 void OnMenuItemSelected( |
| 53 const webkit_glue::CustomContextMenuContext& /* ignored */, |
| 54 unsigned id); |
| 49 | 55 |
| 50 // Load the blocked plugin. | 56 // Load the blocked plugin. |
| 51 void LoadPlugin(); | 57 void LoadPlugin(); |
| 52 | 58 |
| 53 // Javascript callbacks: | 59 // Javascript callbacks: |
| 54 // Load the blocked plugin by calling LoadPlugin(). | 60 // Load the blocked plugin by calling LoadPlugin(). |
| 55 // Takes no arguments, and returns nothing. | 61 // Takes no arguments, and returns nothing. |
| 56 void Load(const CppArgumentList& args, CppVariant* result); | 62 void Load(const CppArgumentList& args, CppVariant* result); |
| 57 | 63 |
| 58 // Hide the blocked plugin by calling HidePlugin(). | 64 // Hide the blocked plugin by calling HidePlugin(). |
| 59 // Takes no arguments, and returns nothing. | 65 // Takes no arguments, and returns nothing. |
| 60 void Hide(const CppArgumentList& args, CppVariant* result); | 66 void Hide(const CppArgumentList& args, CppVariant* result); |
| 61 | 67 |
| 62 // Hide the blocked plugin. | 68 // Hide the blocked plugin. |
| 63 void HidePlugin(); | 69 void HidePlugin(); |
| 64 | 70 |
| 65 WebKit::WebFrame* frame_; | 71 WebKit::WebFrame* frame_; |
| 66 WebKit::WebPluginParams plugin_params_; | 72 WebKit::WebPluginParams plugin_params_; |
| 67 webkit::npapi::WebViewPlugin* plugin_; | 73 webkit::npapi::WebViewPlugin* plugin_; |
| 68 // The name of the plugin that was blocked. | 74 // The name of the plugin that was blocked. |
| 69 string16 name_; | 75 string16 name_; |
| 70 // True iff the plugin was blocked because the page was being prerendered. | 76 // True iff the plugin was blocked because the page was being prerendered. |
| 71 // Plugin will automatically be loaded when the page is displayed. | 77 // Plugin will automatically be loaded when the page is displayed. |
| 72 bool is_blocked_for_prerendering_; | 78 bool is_blocked_for_prerendering_; |
| 73 bool hidden_; | 79 bool hidden_; |
| 74 }; | 80 }; |
| 75 | 81 |
| 76 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ | 82 #endif // CHROME_RENDERER_BLOCKED_PLUGIN_H_ |
| OLD | NEW |