OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
| 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "content/public/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
| 11 #include "webkit/glue/cpp_bound_class.h" |
| 12 #include "webkit/plugins/webview_plugin.h" |
| 13 |
| 14 namespace webkit { |
| 15 struct WebPluginInfo; |
| 16 } |
| 17 |
| 18 // Base class to share code between different plug-in placeholders |
| 19 // used in Chrome. Placeholders can be used if a plug-in is missing or not |
| 20 // available (blocked or disabled). |
| 21 class PluginPlaceholder : public content::RenderViewObserver, |
| 22 public CppBoundClass, |
| 23 public webkit::WebViewPlugin::Delegate { |
| 24 protected: |
| 25 // |render_view| and |frame| are weak pointers. If either one is going away, |
| 26 // our |plugin_| will be destroyed as well and will notify us. |
| 27 PluginPlaceholder(content::RenderView* render_view, |
| 28 WebKit::WebFrame* frame, |
| 29 const WebKit::WebPluginParams& params, |
| 30 const std::string& html_data); |
| 31 virtual ~PluginPlaceholder(); |
| 32 |
| 33 webkit::WebViewPlugin* plugin() { return plugin_; } |
| 34 WebKit::WebFrame* frame() { return frame_; } |
| 35 |
| 36 // Can be called by a subclass to replace this placeholder with an actual |
| 37 // plugin from |plugin_info|. |
| 38 void LoadPluginInternal(const webkit::WebPluginInfo& plugin_info); |
| 39 |
| 40 // WebViewPlugin::Delegate methods: |
| 41 // Can be called by a subclass to hide this placeholder. |
| 42 void HidePluginInternal(); |
| 43 |
| 44 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE; |
| 45 virtual void WillDestroyPlugin() OVERRIDE; |
| 46 virtual void ShowContextMenu(const WebKit::WebMouseEvent& event) OVERRIDE; |
| 47 |
| 48 private: |
| 49 WebKit::WebFrame* frame_; |
| 50 WebKit::WebPluginParams plugin_params_; |
| 51 webkit::WebViewPlugin* plugin_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
OLD | NEW |