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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_placeholder.h

Issue 9609008: Implemented Browser Plugin (NOT FOR REVIEW) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated according to creis@'s comments Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_BROWSER_PLUGIN_BROWSER_PLUGIN_PLACEHOLDER_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_PLACEHOLDER_H_
7 #pragma once
8
9 #include "base/process.h"
10 #include "ipc/ipc_channel_handle.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
13 #include "ui/gfx/size.h"
14 #include "webkit/plugins/webview_plugin.h"
15
16 namespace content {
17 class RenderView;
18 }
19
20 namespace WebKit {
21 class WebPlugin;
22 }
23
24 // A browser plugin is a plugin container that hosts an out-of-process "guest"
25 // RenderView. Loading up a new process, creating a new RenderView, navigating
26 // to a given URL, and establishing a guest-to-host channel can take hundreds
27 // of milliseconds. Furthermore, a RenderView's associated browser-side
28 // WebContents, RenderViewHost, and SiteInstance must be created and accessed on
29 // the UI thread of the browser process.
30 //
31 // To avoid blocking the host RenderView and to avoid introducing the potential
32 // for deadlock, the BrowserPluginPlaceholder takes place of the guest
33 // RenderView until the guest has established a connection with its host
34 // RenderView. This permits loading the guest to happen asynchronously, while
35 // the host RenderView is permitted to continue to receive and process events.
36 class BrowserPluginPlaceholder: public webkit::WebViewPlugin::Delegate {
37 public:
38 // Creates a new WebViewPlugin with a BrowserPluginPlaceholder as a delegate.
39 static webkit::WebViewPlugin* Create(
40 content::RenderView* render_view,
41 WebKit::WebFrame* frame,
42 const WebKit::WebPluginParams& params);
43
44 static BrowserPluginPlaceholder* FromID(int id);
45
46 void RegisterPlaceholder(int id, BrowserPluginPlaceholder* placeholder);
47 void UnregisterPlaceholder(int id);
48
49 int GetID() { return id_; }
50
51 webkit::WebViewPlugin* plugin() { return plugin_; }
52
53 const WebKit::WebPluginParams& plugin_params() const;
54
55 void GuestReady(base::ProcessHandle process_handle,
56 const IPC::ChannelHandle& channel_handle);
57
58 content::RenderView* render_view() { return render_view_; }
59
60 private:
61 BrowserPluginPlaceholder(content::RenderView* render_view,
62 WebKit::WebFrame* frame,
63 const WebKit::WebPluginParams& params,
64 const std::string& html_data);
65 virtual ~BrowserPluginPlaceholder();
66
67 // Grabs the width, height, and source URL of the browser plugin
68 // from the element's attributes. If not found, it uses the defaults
69 // specified here as parameters.
70 void GetPluginParameters(int default_width, int default_height,
71 const std::string& default_src);
72 // Replace this placeholder with the real browser plugin.
73 void LoadGuest(WebKit::WebPlugin* new_plugin);
74
75 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE { }
76 virtual void WillDestroyPlugin() OVERRIDE;
77 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE { }
78
79 content::RenderView* render_view_;
80 WebKit::WebPluginParams plugin_params_;
81 webkit::WebViewPlugin* plugin_;
82 int id_;
83 gfx::Size size_;
84 std::string src_;
85
86 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPlaceholder);
87 };
88
89 #endif // CONTNET_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_PLACEHOLDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698