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

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

Issue 69953006: Bind plugin placeholder directly to v8 instead of over CppBoundClass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 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
Index: components/plugins/renderer/plugin_placeholder.h
diff --git a/components/plugins/renderer/plugin_placeholder.h b/components/plugins/renderer/plugin_placeholder.h
index 2fa6116a921c49a45eee816a4a1163780a01859e..4cee9b763ee379cdfd151a041c7e689fb595c5a7 100644
--- a/components/plugins/renderer/plugin_placeholder.h
+++ b/components/plugins/renderer/plugin_placeholder.h
@@ -5,13 +5,17 @@
#ifndef COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
#define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_
+#include <string>
+#include <vector>
+
+#include "base/memory/weak_ptr.h"
#include "components/plugins/renderer/webview_plugin.h"
#include "content/public/common/webplugininfo.h"
#include "content/public/renderer/context_menu_client.h"
#include "content/public/renderer/render_process_observer.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
-#include "webkit/renderer/cpp_bound_class.h"
+#include "v8/include/v8.h"
namespace content {
struct WebPluginInfo;
@@ -21,7 +25,6 @@ namespace plugins {
// Placeholders can be used if a plug-in is missing or not available
// (blocked or disabled).
class PluginPlaceholder : public content::RenderViewObserver,
- public webkit_glue::CppBoundClass,
public WebViewPlugin::Delegate {
public:
@@ -44,6 +47,13 @@ class PluginPlaceholder : public content::RenderViewObserver,
virtual ~PluginPlaceholder();
+ // Derived classes should invoke this method to install additional callbacks
+ // on the window.plugin object. When the callbacks are invoked, the Observe()
Bernhard Bauer 2013/11/14 16:25:43 Nit: This sentence reads a bit weird. How about, "
jochen (gone - plz use gerrit) 2013/11/15 10:09:39 Done.
+ // method will be invoked.
+ void RegisterCallback(const std::string& callback);
+
+ virtual void Observe(const std::string& callback);
Bernhard Bauer 2013/11/14 16:25:43 Nit: add a comment
jochen (gone - plz use gerrit) 2013/11/15 10:09:39 Done.
+
void OnLoadBlockedPlugins(const std::string& identifier);
void OnSetIsPrerendering(bool is_prerendering);
@@ -73,20 +83,7 @@ class PluginPlaceholder : public content::RenderViewObserver,
virtual void WillDestroyPlugin() OVERRIDE;
virtual void ShowContextMenu(const blink::WebMouseEvent&) OVERRIDE;
- // Javascript callbacks:
- // All ignore arguments (which are, however, required by caller) and return
- // nothing.
-
- // Load the blocked plugin by calling LoadPlugin().
- void LoadCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
-
- // Hide the blocked plugin by calling HidePlugin().
- void HideCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
-
- void DidFinishLoadingCallback(const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result);
+ void InternalObserve(const std::string& callback);
void UpdateMessage();
@@ -107,6 +104,10 @@ class PluginPlaceholder : public content::RenderViewObserver,
bool finished_loading_;
std::string identifier_;
+ std::vector<std::string> callbacks_;
+
+ base::WeakPtrFactory<PluginPlaceholder> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder);
};

Powered by Google App Engine
This is Rietveld 408576698