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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
7 #pragma once
8
9 #include "base/process.h"
10 #include "content/renderer/render_view_impl.h"
11 #include "ipc/ipc_channel_handle.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
14 #include "ui/gfx/size.h"
15 #include "webkit/plugins/webview_plugin.h"
16
17 namespace content {
18 class RenderView;
19 }
20
21 namespace WebKit {
22 class WebPlugin;
23 }
24
25 // A browser plugin is a plugin container that hosts an out-of-process "guest"
26 // RenderView. Loading up a new process, creating a new RenderView, navigating
27 // to a given URL, and establishing a guest-to-embedder channel can take
28 // hundreds of milliseconds. Furthermore, a RenderView's associated browser-side
29 // WebContents, RenderViewHost, and SiteInstance must be created and accessed on
30 // the UI thread of the browser process.
31 //
32 // To avoid blocking the embedder RenderView and to avoid introducing the
33 // potential for deadlock, BrowserPlugin attaches a placeholder that takes
34 // place of the guest RenderView until the guest has established a connection
35 // with its embedder RenderView. This permits asynchronously loading of the
36 // guest while the embedder RenderView is permitted to continue to receive and
37 // process events.
38 //
39 // Furthermore, certain navigations can swap to a new guest RenderView on an
40 // different process. BrowserPlugin is the consistent facade that the embedder's
41 // WebKit instance talks to regardless of which process it's communicating with.
42 class BrowserPlugin {
43 public:
44 // Creates a new WebViewPlugin with a BrowserPlugin as a delegate.
45 static WebKit::WebPlugin* Create(
46 RenderViewImpl* render_view,
47 WebKit::WebFrame* frame,
48 const WebKit::WebPluginParams& params);
49
50 static BrowserPlugin* FromID(int id);
51
52 webkit::WebViewPlugin* placeholder() { return placeholder_; }
53
54 webkit::ppapi::WebPluginImpl* plugin() { return plugin_; }
55
56 const WebKit::WebPluginParams& plugin_params() const {
57 return plugin_params_;
58 }
59
60 void LoadGuest(int guest_process_id,
61 const IPC::ChannelHandle& channel_handle);
62
63 RenderViewImpl* render_view() { return render_view_; }
64
65 private:
66 BrowserPlugin(RenderViewImpl* render_view,
67 WebKit::WebFrame* frame,
68 const WebKit::WebPluginParams& params,
69 const std::string& html_data);
70 virtual ~BrowserPlugin();
71
72 // Parses the width, height, and source URL of the browser plugin
73 // from the element's attributes and outputs them to size and src. If not
74 // found, it uses the defaults specified here as parameters.
75 void ParsePluginParameters(int default_width, int default_height,
76 const std::string& default_src,
77 gfx::Size* size,
78 std::string* src);
79 // Replace the current guest with a new guest.
80 void Replace(webkit::ppapi::WebPluginImpl* new_plugin);
81
82 RenderViewImpl* render_view_;
83 WebKit::WebPluginParams plugin_params_;
84 webkit::WebViewPlugin* placeholder_;
85 webkit::ppapi::WebPluginImpl* plugin_;
86 int id_;
87
88 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
89 };
90
91 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698