Index: content/renderer/plugins/browser_plugin_placeholder.h |
diff --git a/content/renderer/plugins/browser_plugin_placeholder.h b/content/renderer/plugins/browser_plugin_placeholder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5f8ef0a55c7fec00f0d4c044a6a80f3a7575af2d |
--- /dev/null |
+++ b/content/renderer/plugins/browser_plugin_placeholder.h |
@@ -0,0 +1,82 @@ |
+// Copyright (c) 2012 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 CONTENT_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_ |
+#define CONTENT_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_ |
+#pragma once |
+ |
+#include "base/process.h" |
+#include "content/public/renderer/render_process_observer.h" |
+#include "content/public/renderer/render_view_observer.h" |
+#include "content/renderer/guest_render_view_observer.h" |
+#include "ipc/ipc_channel_handle.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
+#include "webkit/plugins/webview_plugin.h" |
+ |
+namespace content { |
+class RenderThread; |
+class RenderView; |
+} |
+ |
+namespace WebKit { |
+class WebFrame; |
+class WebPlugin; |
+} |
+ |
+class BrowserPluginPlaceholder: public webkit::WebViewPlugin::Delegate { |
+ public: |
+ // Creates a new WebViewPlugin with a BrowserPluginPlaceholder as a delegate. |
+ static webkit::WebViewPlugin* Create( |
+ content::RenderView* render_view, |
+ WebKit::WebFrame* frame, |
+ const WebKit::WebPluginParams& params); |
+ |
+ static BrowserPluginPlaceholder* FromID(int id); |
+ |
+ void RegisterPlaceholder(int id, BrowserPluginPlaceholder* placeholder); |
+ void UnregisterPlaceholder(int id); |
+ |
+ int GetID() { return id_; } |
+ |
+ webkit::WebViewPlugin* plugin() { return plugin_; } |
+ |
+ const WebKit::WebPluginParams& plugin_params() const; |
+ |
+ void GuestReady(base::ProcessHandle process_handle, |
+ const IPC::ChannelHandle& channel_handle); |
+ |
+ content::RenderView* render_view() { return render_view_; } |
+ |
+ private: |
+ BrowserPluginPlaceholder(content::RenderView* render_view, |
+ WebKit::WebFrame* frame, |
+ const WebKit::WebPluginParams& params, |
+ const std::string& html_data); |
+ virtual ~BrowserPluginPlaceholder(); |
+ |
+ // Grabs the width, height, and source URL of the browser plugin |
+ // from the element's attributes. If not found, it uses the defaults |
+ // specified here as parameters. |
+ void GetPluginParameters(int default_width, int default_height, |
+ const std::string& default_src); |
+ // Replace this placeholder with the real browser plugin. |
+ void LoadGuest(WebKit::WebPlugin* new_plugin); |
+ |
+ virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE { } |
+ virtual void WillDestroyPlugin() OVERRIDE; |
+ virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE { } |
+ |
+ content::RenderView* render_view_; |
+ WebKit::WebPluginParams plugin_params_; |
+ webkit::WebViewPlugin* plugin_; |
+ int id_; |
+ int width_; |
+ int height_; |
+ std::string src_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginPlaceholder); |
+}; |
+ |
+#endif // CONTNET_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_ |