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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/browser_plugin/browser_plugin.h
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
new file mode 100644
index 0000000000000000000000000000000000000000..955e9ec10df7270217aee2bf0dfd4b1b89d08627
--- /dev/null
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -0,0 +1,91 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
+#define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
+#pragma once
+
+#include "base/process.h"
+#include "content/renderer/render_view_impl.h"
+#include "ipc/ipc_channel_handle.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
+#include "ui/gfx/size.h"
+#include "webkit/plugins/webview_plugin.h"
+
+namespace content {
+class RenderView;
+}
+
+namespace WebKit {
+class WebPlugin;
+}
+
+// A browser plugin is a plugin container that hosts an out-of-process "guest"
+// RenderView. Loading up a new process, creating a new RenderView, navigating
+// to a given URL, and establishing a guest-to-embedder channel can take
+// hundreds of milliseconds. Furthermore, a RenderView's associated browser-side
+// WebContents, RenderViewHost, and SiteInstance must be created and accessed on
+// the UI thread of the browser process.
+//
+// To avoid blocking the embedder RenderView and to avoid introducing the
+// potential for deadlock, BrowserPlugin attaches a placeholder that takes
+// place of the guest RenderView until the guest has established a connection
+// with its embedder RenderView. This permits asynchronously loading of the
+// guest while the embedder RenderView is permitted to continue to receive and
+// process events.
+//
+// Furthermore, certain navigations can swap to a new guest RenderView on an
+// different process. BrowserPlugin is the consistent facade that the embedder's
+// WebKit instance talks to regardless of which process it's communicating with.
+class BrowserPlugin {
+ public:
+ // Creates a new WebViewPlugin with a BrowserPlugin as a delegate.
+ static WebKit::WebPlugin* Create(
+ RenderViewImpl* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params);
+
+ static BrowserPlugin* FromID(int id);
+
+ webkit::WebViewPlugin* placeholder() { return placeholder_; }
+
+ webkit::ppapi::WebPluginImpl* plugin() { return plugin_; }
+
+ const WebKit::WebPluginParams& plugin_params() const {
+ return plugin_params_;
+ }
+
+ void LoadGuest(int guest_process_id,
+ const IPC::ChannelHandle& channel_handle);
+
+ RenderViewImpl* render_view() { return render_view_; }
+
+ private:
+ BrowserPlugin(RenderViewImpl* render_view,
+ WebKit::WebFrame* frame,
+ const WebKit::WebPluginParams& params,
+ const std::string& html_data);
+ virtual ~BrowserPlugin();
+
+ // Parses the width, height, and source URL of the browser plugin
+ // from the element's attributes and outputs them to size and src. If not
+ // found, it uses the defaults specified here as parameters.
+ void ParsePluginParameters(int default_width, int default_height,
+ const std::string& default_src,
+ gfx::Size* size,
+ std::string* src);
+ // Replace the current guest with a new guest.
+ void Replace(webkit::ppapi::WebPluginImpl* new_plugin);
+
+ RenderViewImpl* render_view_;
+ WebKit::WebPluginParams plugin_params_;
+ webkit::WebViewPlugin* placeholder_;
+ webkit::ppapi::WebPluginImpl* plugin_;
+ int id_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
+};
+
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
« 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