Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 3e59c4a9b643091fd8e35480b4daf5dfc1b9df4f..22c679e9c0b7e8fd5fca6b78bbe91722f22f8120 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -55,6 +55,7 @@ |
#include "content/renderer/dom_automation_controller.h" |
#include "content/renderer/external_popup_menu.h" |
#include "content/renderer/geolocation_dispatcher.h" |
+#include "content/renderer/guest_render_view_observer.h" |
#include "content/renderer/idle_user_detector.h" |
#include "content/renderer/input_tag_speech_dispatcher.h" |
#include "content/renderer/web_intents_host.h" |
@@ -73,6 +74,7 @@ |
#include "content/renderer/notification_provider.h" |
#include "content/renderer/p2p/socket_dispatcher.h" |
#include "content/renderer/plugin_channel_host.h" |
+#include "content/renderer/plugins/browser_plugin_placeholder.h" |
#include "content/renderer/render_process.h" |
#include "content/renderer/render_thread_impl.h" |
#include "content/renderer/render_widget_fullscreen_pepper.h" |
@@ -165,6 +167,7 @@ |
#include "webkit/plugins/npapi/plugin_list.h" |
#include "webkit/plugins/npapi/webplugin_delegate.h" |
#include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
+#include "webkit/plugins/plugin_constants.h" |
#include "webkit/plugins/npapi/webplugin_impl.h" |
#include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
@@ -444,6 +447,7 @@ RenderViewImpl::RenderViewImpl( |
queried_for_swapbuffers_complete_callback_(false), |
ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
geolocation_dispatcher_(NULL), |
+ guest_observer_(NULL), |
input_tag_speech_dispatcher_(NULL), |
device_orientation_dispatcher_(NULL), |
media_stream_dispatcher_(NULL), |
@@ -497,6 +501,13 @@ RenderViewImpl::RenderViewImpl( |
g_view_map.Get().insert(std::make_pair(webview(), this)); |
webkit_preferences_.Apply(webview()); |
+ |
+ // This needs to be before initializeMainFrame it seems. |
+ // PpapiMsg_CreateChannel messages can get lost if the guest |
+ // observer has not been constructed before a sync message. |
+ if (!guest_observer_) |
+ guest_observer_ = new GuestRenderViewObserver(this); |
+ |
webview()->initializeMainFrame(this); |
if (!frame_name.empty()) |
webview()->mainFrame()->setName(frame_name); |
@@ -826,13 +837,11 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
// Have the super handle all other messages. |
IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
IPC_END_MESSAGE_MAP() |
- |
if (!msg_is_ok) { |
// The message had a handler, but its deserialization failed. |
// Kill the renderer to avoid potential spoofing attacks. |
CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
} |
- |
return handled; |
} |
@@ -1549,6 +1558,9 @@ WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( |
bool direct) { |
if (!webview()) |
return NULL; |
+ |
+ if (guest_observer_ && guest_observer_->GetWebGraphicsContext3D()) |
+ return guest_observer_->GetWebGraphicsContext3D(); |
// The WebGraphicsContext3DInProcessImpl code path is used for |
// layout tests (though not through this code) as well as for |
// debugging and bringing up new ports. |
@@ -3432,10 +3444,29 @@ bool RenderViewImpl::IsEditableNode(const WebKit::WebNode& node) { |
return is_editable_node; |
} |
+WebKit::WebPlugin* RenderViewImpl::CreateBrowserPlugin( |
+ base::ProcessHandle process_handle, |
+ const IPC::ChannelHandle& channel_handle, |
+ const WebKit::WebPluginParams& params) { |
+ scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
+ pepper_delegate_.CreateBrowserPluginModule(process_handle, |
+ channel_handle)); |
+ return new webkit::ppapi::WebPluginImpl( |
+ pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); |
+} |
+ |
WebKit::WebPlugin* RenderViewImpl::CreatePlugin( |
WebKit::WebFrame* frame, |
const webkit::WebPluginInfo& info, |
const WebKit::WebPluginParams& params) { |
+ |
+ // The browser plugin is a special kind of pepper plugin |
+ // that loads asynchronously. We first create a placeholder here. |
+ // When a guest is ready to be displayed, we swap out the placeholder |
+ // with the guest. |
+ if (UTF16ToASCII(info.name) == kBrowserPluginName) |
+ return BrowserPluginPlaceholder::Create(this, frame, params); |
+ |
bool pepper_plugin_was_registered = false; |
scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
pepper_delegate_.CreatePepperPluginModule(info, |