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