Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 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 CONTENT_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_ | |
| 6 #define CONTENT_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/process.h" | |
| 10 #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
| |
| 11 #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.
| |
| 12 #include "ipc/ipc_channel_handle.h" | |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | |
| 15 #include "webkit/plugins/webview_plugin.h" | |
| 16 | |
| 17 namespace content { | |
| 18 class RenderThread; | |
|
jam
2012/03/12 16:30:09
why?
Fady Samuel
2012/03/12 22:11:44
Done.
| |
| 19 class RenderView; | |
| 20 } | |
| 21 | |
| 22 namespace WebKit { | |
| 23 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.
| |
| 24 class WebPlugin; | |
| 25 } | |
| 26 | |
| 27 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.
| |
| 28 public: | |
| 29 // Creates a new WebViewPlugin with a BrowserPluginPlaceholder as a delegate. | |
| 30 static webkit::WebViewPlugin* Create( | |
| 31 content::RenderView* render_view, | |
| 32 WebKit::WebFrame* frame, | |
| 33 const WebKit::WebPluginParams& params); | |
| 34 | |
| 35 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
| |
| 36 | |
| 37 void RegisterPlaceholder(int id, BrowserPluginPlaceholder* placeholder); | |
| 38 void UnregisterPlaceholder(int id); | |
|
jam
2012/03/12 16:30:09
ditto
Fady Samuel
2012/03/12 22:11:44
Please see above.
| |
| 39 | |
| 40 int GetID() { return id_; } | |
| 41 | |
| 42 webkit::WebViewPlugin* plugin() { return plugin_; } | |
| 43 | |
| 44 const WebKit::WebPluginParams& plugin_params() const; | |
| 45 | |
| 46 void GuestReady(base::ProcessHandle process_handle, | |
| 47 const IPC::ChannelHandle& channel_handle); | |
| 48 | |
| 49 content::RenderView* render_view() { return render_view_; } | |
| 50 | |
| 51 private: | |
| 52 BrowserPluginPlaceholder(content::RenderView* render_view, | |
| 53 WebKit::WebFrame* frame, | |
| 54 const WebKit::WebPluginParams& params, | |
| 55 const std::string& html_data); | |
| 56 virtual ~BrowserPluginPlaceholder(); | |
| 57 | |
| 58 // Grabs the width, height, and source URL of the browser plugin | |
| 59 // from the element's attributes. If not found, it uses the defaults | |
| 60 // specified here as parameters. | |
| 61 void GetPluginParameters(int default_width, int default_height, | |
| 62 const std::string& default_src); | |
| 63 // Replace this placeholder with the real browser plugin. | |
| 64 void LoadGuest(WebKit::WebPlugin* new_plugin); | |
| 65 | |
| 66 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE { } | |
| 67 virtual void WillDestroyPlugin() OVERRIDE; | |
| 68 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE { } | |
| 69 | |
| 70 content::RenderView* render_view_; | |
| 71 WebKit::WebPluginParams plugin_params_; | |
| 72 webkit::WebViewPlugin* plugin_; | |
| 73 int id_; | |
| 74 int width_; | |
| 75 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.
| |
| 76 std::string src_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPlaceholder); | |
| 79 }; | |
| 80 | |
| 81 #endif // CONTNET_RENDERER_PLUGINS_BROWSER_PLUGIN_PLACEHOLDER_H_ | |
| OLD | NEW |