Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3258)

Unified Diff: chrome/renderer/plugins/plugin_placeholder.h

Issue 8461011: Clean up plug-in placeholders: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/plugins/missing_plugin.cc ('k') | chrome/renderer/plugins/plugin_placeholder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/plugins/plugin_placeholder.h
diff --git a/chrome/renderer/plugins/plugin_placeholder.h b/chrome/renderer/plugins/plugin_placeholder.h
new file mode 100644
index 0000000000000000000000000000000000000000..009d30051b5c25ee53b5ffcdbbede1addb3cb51c
--- /dev/null
+++ b/chrome/renderer/plugins/plugin_placeholder.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
+#define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
+#pragma once
+
+#include "content/public/renderer/render_view_observer.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
+#include "webkit/glue/cpp_bound_class.h"
+#include "webkit/plugins/webview_plugin.h"
+
+namespace webkit {
+struct WebPluginInfo;
+}
+
+// Base class to share code between different plug-in placeholders
+// used in Chrome. Placeholders can be used if a plug-in is missing or not
+// available (blocked or disabled).
+class PluginPlaceholder : public content::RenderViewObserver,
+ public CppBoundClass,
+ public webkit::WebViewPlugin::Delegate {
+ protected:
+ // |render_view| and |frame| are weak pointers. If either one is going away,
+ // our |plugin_| will be destroyed as well and will notify us.
+ PluginPlaceholder(content::RenderView* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params,
+ const std::string& html_data);
+ virtual ~PluginPlaceholder();
+
+ webkit::WebViewPlugin* plugin() { return plugin_; }
+ WebKit::WebFrame* frame() { return frame_; }
+
+ // Can be called by a subclass to replace this placeholder with an actual
+ // plugin from |plugin_info|.
+ void LoadPluginInternal(const webkit::WebPluginInfo& plugin_info);
+
+ // WebViewPlugin::Delegate methods:
+ // Can be called by a subclass to hide this placeholder.
+ void HidePluginInternal();
+
+ virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE;
+ virtual void WillDestroyPlugin() OVERRIDE;
+ virtual void ShowContextMenu(const WebKit::WebMouseEvent& event) OVERRIDE;
+
+ private:
+ WebKit::WebFrame* frame_;
+ WebKit::WebPluginParams plugin_params_;
+ webkit::WebViewPlugin* plugin_;
+
+ DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
+};
+
+#endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_
« no previous file with comments | « chrome/renderer/plugins/missing_plugin.cc ('k') | chrome/renderer/plugins/plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698