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

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

Issue 9968097: Browser Plugin: Renderer-side changes (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated to compile with clang 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_PLACEHOLDER_H_ 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_PLACEHOLDER_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "content/renderer/render_view_impl.h"
10 #include "ipc/ipc_channel_handle.h" 11 #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/platform/WebString.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
13 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
14 #include "webkit/plugins/webview_plugin.h" 15 #include "webkit/plugins/webview_plugin.h"
15 16
16 namespace content { 17 namespace content {
17 class RenderView; 18 class RenderView;
18 } 19 }
19 20
20 namespace WebKit { 21 namespace WebKit {
21 class WebPlugin; 22 class WebPlugin;
22 } 23 }
23 24
24 // A browser plugin is a plugin container that hosts an out-of-process "guest" 25 // 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 // 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 // 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 // of milliseconds. Furthermore, a RenderView's associated browser-side
28 // WebContents, RenderViewHost, and SiteInstance must be created and accessed on 29 // WebContents, RenderViewHost, and SiteInstance must be created and accessed on
29 // the UI thread of the browser process. 30 // the UI thread of the browser process.
30 // 31 //
31 // To avoid blocking the host RenderView and to avoid introducing the potential 32 // To avoid blocking the host RenderView and to avoid introducing the potential
32 // for deadlock, the BrowserPluginPlaceholder takes place of the guest 33 // for deadlock, the BrowserPlugin takes place of the guest
33 // RenderView until the guest has established a connection with its host 34 // RenderView until the guest has established a connection with its host
34 // RenderView. This permits loading the guest to happen asynchronously, while 35 // RenderView. This permits loading the guest to happen asynchronously, while
35 // the host RenderView is permitted to continue to receive and process events. 36 // the host RenderView is permitted to continue to receive and process events.
36 class BrowserPluginPlaceholder: public webkit::WebViewPlugin::Delegate { 37 //
38 // Furthermore, certain navigations can point to a new guest RenderView on an
Charlie Reis 2012/05/17 20:36:47 nit: point -> swap (to be consistent with our othe
Fady Samuel 2012/05/17 22:18:03 Done.
39 // entirely different process. BrowserPlugin is the consistent facade that the
40 // embedder talks to regardless of what process it' actually communicating with.
Charlie Reis 2012/05/17 20:36:47 nit: it' -> it's
Fady Samuel 2012/05/17 22:18:03 Done.
41 class BrowserPlugin {
37 public: 42 public:
38 // Creates a new WebViewPlugin with a BrowserPluginPlaceholder as a delegate. 43 // Creates a new WebViewPlugin with a BrowserPlugin as a delegate.
39 static webkit::WebViewPlugin* Create( 44 static WebKit::WebPlugin* Create(
40 content::RenderView* render_view, 45 RenderViewImpl* render_view,
41 WebKit::WebFrame* frame, 46 WebKit::WebFrame* frame,
42 const WebKit::WebPluginParams& params); 47 const WebKit::WebPluginParams& params);
43 48
44 static BrowserPluginPlaceholder* FromID(int id); 49 static BrowserPlugin* FromID(int id);
45 50
46 void RegisterPlaceholder(int id, BrowserPluginPlaceholder* placeholder); 51 webkit::WebViewPlugin* placeholder() { return placeholder_; }
47 void UnregisterPlaceholder(int id);
48 52
49 int GetID() { return id_; } 53 webkit::ppapi::WebPluginImpl* plugin() { return plugin_; }
50 54
51 webkit::WebViewPlugin* plugin() { return plugin_; } 55 const WebKit::WebPluginParams& plugin_params() const {
56 return plugin_params_;
57 }
52 58
53 const WebKit::WebPluginParams& plugin_params() const; 59 void LoadGuest(int guest_process_id,
60 const IPC::ChannelHandle& channel_handle);
54 61
55 void GuestReady(base::ProcessHandle process_handle, 62 RenderViewImpl* render_view() { return render_view_; }
56 const IPC::ChannelHandle& channel_handle);
57
58 content::RenderView* render_view() { return render_view_; }
59 63
60 private: 64 private:
61 BrowserPluginPlaceholder(content::RenderView* render_view, 65 BrowserPlugin(RenderViewImpl* render_view,
62 WebKit::WebFrame* frame, 66 WebKit::WebFrame* frame,
63 const WebKit::WebPluginParams& params, 67 const WebKit::WebPluginParams& params,
64 const std::string& html_data); 68 const std::string& html_data);
65 virtual ~BrowserPluginPlaceholder(); 69 virtual ~BrowserPlugin();
66 70
67 // Grabs the width, height, and source URL of the browser plugin 71 // Grabs the width, height, and source URL of the browser plugin
Charlie Reis 2012/05/17 20:36:47 Grabs and does what with them? They aren't return
Fady Samuel 2012/05/17 22:18:03 Agreed, it's ugly. I renamed this to ParsePluginPa
68 // from the element's attributes. If not found, it uses the defaults 72 // from the element's attributes. If not found, it uses the defaults
69 // specified here as parameters. 73 // specified here as parameters.
70 void GetPluginParameters(int default_width, int default_height, 74 void GetPluginParameters(int default_width, int default_height,
71 const std::string& default_src); 75 const std::string& default_src);
72 // Replace this placeholder with the real browser plugin. 76 // Replace the current guest with a new guest.
73 void LoadGuest(WebKit::WebPlugin* new_plugin); 77 void Replace(webkit::ppapi::WebPluginImpl* new_plugin);
74 78
75 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE { } 79 RenderViewImpl* render_view_;
76 virtual void WillDestroyPlugin() OVERRIDE;
77 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE { }
78
79 content::RenderView* render_view_;
80 WebKit::WebPluginParams plugin_params_; 80 WebKit::WebPluginParams plugin_params_;
81 webkit::WebViewPlugin* plugin_; 81 webkit::WebViewPlugin* placeholder_;
82 webkit::ppapi::WebPluginImpl* plugin_;
82 int id_; 83 int id_;
83 gfx::Size size_; 84 gfx::Size size_;
84 std::string src_; 85 std::string src_;
85 86
86 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPlaceholder); 87 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
87 }; 88 };
88 89
89 #endif // CONTNET_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_PLACEHOLDER_H_ 90 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698