| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PLUGINS_PLUGIN_PLACEHOLDER_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
| 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ | 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
| 7 | 7 |
| 8 #include "content/public/renderer/context_menu_client.h" |
| 8 #include "content/public/renderer/render_process_observer.h" | 9 #include "content/public/renderer/render_process_observer.h" |
| 9 #include "content/public/renderer/render_view_observer.h" | 10 #include "content/public/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
| 11 #include "webkit/glue/cpp_bound_class.h" | 12 #include "webkit/glue/cpp_bound_class.h" |
| 12 #include "webkit/plugins/webplugininfo.h" | 13 #include "webkit/plugins/webplugininfo.h" |
| 13 #include "webkit/plugins/webview_plugin.h" | 14 #include "webkit/plugins/webview_plugin.h" |
| 14 | 15 |
| 15 struct ChromeViewHostMsg_GetPluginInfo_Status; | 16 struct ChromeViewHostMsg_GetPluginInfo_Status; |
| 16 | 17 |
| 17 namespace webkit { | 18 namespace webkit { |
| 18 struct WebPluginInfo; | 19 struct WebPluginInfo; |
| 19 } | 20 } |
| 20 | 21 |
| 21 // Placeholders can be used if a plug-in is missing or not available | 22 // Placeholders can be used if a plug-in is missing or not available |
| 22 // (blocked or disabled). | 23 // (blocked or disabled). |
| 23 class PluginPlaceholder : public content::RenderViewObserver, | 24 class PluginPlaceholder : public content::RenderViewObserver, |
| 24 public content::RenderProcessObserver, | 25 public content::RenderProcessObserver, |
| 25 public webkit_glue::CppBoundClass, | 26 public webkit_glue::CppBoundClass, |
| 26 public webkit::WebViewPlugin::Delegate { | 27 public webkit::WebViewPlugin::Delegate, |
| 28 public content::ContextMenuClient { |
| 27 public: | 29 public: |
| 28 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. | 30 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. |
| 29 static PluginPlaceholder* CreateMissingPlugin( | 31 static PluginPlaceholder* CreateMissingPlugin( |
| 30 content::RenderView* render_view, | 32 content::RenderView* render_view, |
| 31 WebKit::WebFrame* frame, | 33 WebKit::WebFrame* frame, |
| 32 const WebKit::WebPluginParams& params); | 34 const WebKit::WebPluginParams& params); |
| 33 | 35 |
| 34 static PluginPlaceholder* CreateErrorPlugin( | 36 static PluginPlaceholder* CreateErrorPlugin( |
| 35 content::RenderView* render_view, | 37 content::RenderView* render_view, |
| 36 const FilePath& plugin_path); | 38 const FilePath& plugin_path); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const string16& title); | 88 const string16& title); |
| 87 | 89 |
| 88 virtual ~PluginPlaceholder(); | 90 virtual ~PluginPlaceholder(); |
| 89 | 91 |
| 90 // WebViewPlugin::Delegate methods: | 92 // WebViewPlugin::Delegate methods: |
| 91 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE; | 93 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE; |
| 92 virtual void WillDestroyPlugin() OVERRIDE; | 94 virtual void WillDestroyPlugin() OVERRIDE; |
| 93 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; | 95 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; |
| 94 | 96 |
| 95 // content::RenderViewObserver methods: | 97 // content::RenderViewObserver methods: |
| 96 virtual void ContextMenuAction(unsigned id) OVERRIDE; | |
| 97 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 98 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 98 | 99 |
| 99 // content::RenderProcessObserver methods: | 100 // content::RenderProcessObserver methods: |
| 100 virtual void PluginListChanged() OVERRIDE; | 101 virtual void PluginListChanged() OVERRIDE; |
| 101 | 102 |
| 103 // content::ContextMenuClient methods: |
| 104 virtual void OnCustomContextMenuAction(int request_id, |
| 105 unsigned action) OVERRIDE; |
| 106 virtual void OnCustomContextMenuClosed(int request_id) OVERRIDE; |
| 107 |
| 102 // Replace this placeholder with a different plugin (which could be | 108 // Replace this placeholder with a different plugin (which could be |
| 103 // a placeholder again). | 109 // a placeholder again). |
| 104 void ReplacePlugin(WebKit::WebPlugin* new_plugin); | 110 void ReplacePlugin(WebKit::WebPlugin* new_plugin); |
| 105 | 111 |
| 106 // Hide this placeholder. | 112 // Hide this placeholder. |
| 107 void HidePlugin(); | 113 void HidePlugin(); |
| 108 | 114 |
| 109 // Load the blocked plugin. | 115 // Load the blocked plugin. |
| 110 void LoadPlugin(); | 116 void LoadPlugin(); |
| 111 | 117 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // |routing_id()| is the routing ID of our associated RenderView, but we have | 179 // |routing_id()| is the routing ID of our associated RenderView, but we have |
| 174 // a separate routing ID for messages specific to this placeholder. | 180 // a separate routing ID for messages specific to this placeholder. |
| 175 int32 placeholder_routing_id_; | 181 int32 placeholder_routing_id_; |
| 176 #endif | 182 #endif |
| 177 | 183 |
| 178 bool hidden_; | 184 bool hidden_; |
| 179 bool has_host_; | 185 bool has_host_; |
| 180 bool finished_loading_; | 186 bool finished_loading_; |
| 181 string16 plugin_name_; | 187 string16 plugin_name_; |
| 182 std::string identifier_; | 188 std::string identifier_; |
| 189 int context_menu_request_id_; // Nonzero when request pending. |
| 183 | 190 |
| 184 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); | 191 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); |
| 185 }; | 192 }; |
| 186 | 193 |
| 187 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ | 194 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
| OLD | NEW |