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

Unified Diff: content/renderer/plugins/browser_plugin_placeholder.h

Issue 9668031: Implement BrowserPluginPlaceholder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 9 months 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: 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..81cac33f2000fa589b949aeaba2e57b24af4a0f4
--- /dev/null
+++ b/content/renderer/plugins/browser_plugin_placeholder.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
jam 2012/03/12 16:30:09 content/renderer/plugins is a bit misleading, sinc
Fady Samuel 2012/03/12 22:11:44 Currently there are about a half dozen new files.
+// 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"
jam 2012/03/12 16:30:09 why?
Fady Samuel 2012/03/12 22:11:44 Doesn't look like they are necessary. Probably a r
+#include "content/public/renderer/render_view_observer.h"
jam 2012/03/12 16:30:09 ditto
Fady Samuel 2012/03/12 22:11:44 Done.
+#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;
jam 2012/03/12 16:30:09 why?
Fady Samuel 2012/03/12 22:11:44 Done.
+class RenderView;
+}
+
+namespace WebKit {
+class WebFrame;
jam 2012/03/12 16:30:09 nit: not needed since thi sis in webview_plugin.h
Fady Samuel 2012/03/12 22:11:44 Done.
+class WebPlugin;
+}
+
+class BrowserPluginPlaceholder: public webkit::WebViewPlugin::Delegate {
jam 2012/03/12 16:30:09 there should be a comment on this class saying wha
Fady Samuel 2012/03/12 22:11:44 Done.
+ 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);
jam 2012/03/12 16:30:09 it's hard to see if this method is needed or not,
Fady Samuel 2012/03/12 22:11:44 One RenderView can have multiple browser plugins w
+
+ void RegisterPlaceholder(int id, BrowserPluginPlaceholder* placeholder);
+ void UnregisterPlaceholder(int id);
jam 2012/03/12 16:30:09 ditto
Fady Samuel 2012/03/12 22:11:44 Please see above.
+
+ 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_;
jam 2012/03/12 16:30:09 nit: instead of width_ and height_, use gfx::Size
Fady Samuel 2012/03/12 22:11:44 Done.
+ std::string src_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginPlaceholder);
+};
+
+#endif // CONTNET_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_

Powered by Google App Engine
This is Rietveld 408576698