Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index c70cbd09bbadece534bc5c460a622594275429d3..b392be6704208b360b79d332ea7d1325fe19edd9 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -15,6 +15,8 @@ |
#include "base/sys_info.h" |
#include "base/time.h" |
#include "base/utf_string_conversions.h" |
+#include "content/browser/browser_plugin/browser_plugin_host_embedder_role.h" |
+#include "content/browser/browser_plugin/browser_plugin_host_guest_role.h" |
#include "content/browser/browser_plugin/old/old_browser_plugin_host.h" |
#include "content/browser/child_process_security_policy_impl.h" |
#include "content/browser/debugger/devtools_manager_impl.h" |
@@ -34,6 +36,7 @@ |
#include "content/browser/web_contents/interstitial_page_impl.h" |
#include "content/browser/web_contents/navigation_entry_impl.h" |
#include "content/browser/webui/web_ui_impl.h" |
+#include "content/common/browser_plugin_messages.h" |
#include "content/common/intents_messages.h" |
#include "content/common/ssl_status_serialization.h" |
#include "content/common/view_messages.h" |
@@ -686,6 +689,8 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
OnSetSelectedColorInColorChooser) |
IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) |
IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateGuest, |
+ OnBrowserPluginNavigateGuest) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP_EX() |
message_source_ = NULL; |
@@ -2178,6 +2183,27 @@ void WebContentsImpl::OnWebUISend(const GURL& source_url, |
delegate_->WebUISend(this, source_url, name, args); |
} |
+void WebContentsImpl::OnBrowserPluginNavigateGuest(int instance_id, |
+ int64 frame_id, |
+ std::string src, |
+ gfx::Size size) { |
+ // This is the first 'navigate' to a browser plugin, before WebContents plays |
+ // an 'Embedder' role, subsequent navigate messages for this WebContents will |
+ // be handled by the BrowserPluginHostEmbedderRole itself (this also means any |
+ // message from browser plugin renderer prior to NavigateGuest which is not |
+ // NavigateGuest will be ignored). Therefore |
+ // embedder_role_ should no be set. |
rjkroege
2012/08/22 21:57:38
not be
lazyboy
2012/08/23 00:45:22
Done.
|
+ DCHECK(!embedder_role_.get()); |
+ |
+ // TODO(lazyboy, rjkroege): Can this trigger a race condition if first two |
+ // 'navigate' messages are around the same time (i.e. both gets routed to |
rjkroege
2012/08/22 21:57:38
regarding the possible race: as I understand the c
lazyboy
2012/08/23 00:45:22
Great, added the note.
|
+ // WebContents before BrowserPluginHostEmbedderRole has a chance to intercept |
+ // the second 'navigate' message)? |
+ embedder_role_.reset( |
+ new content::BrowserPluginHostEmbedderRole(this, GetRenderViewHost())); |
rjkroege
2012/08/22 21:57:38
Why do you not use the AddGuestRole here?
lazyboy
2012/08/23 00:45:22
This would be called AddEmbedderRole instead, but
|
+ embedder_role_->NavigateGuest(instance_id, frame_id, src, size); |
+} |
+ |
// Notifies the RenderWidgetHost instance about the fact that the page is |
// loading, or done loading and calls the base implementation. |
void WebContentsImpl::SetIsLoading(bool is_loading, |
@@ -3148,3 +3174,19 @@ void WebContentsImpl::GetBrowserPluginEmbedderInfo( |
embedder_process_id); |
} |
} |
+ |
+content::BrowserPluginHostGuestRole* WebContentsImpl::AddGuestRole( |
+ int instance_id, |
+ content::RenderProcessHost* render_process_host) { |
+ guest_role_.reset(new content::BrowserPluginHostGuestRole( |
+ instance_id, this, GetRenderViewHost())); |
+ return guest_role_.get(); |
+} |
+ |
+content::BrowserPluginHostGuestRole* WebContentsImpl::GetGuestRole() { |
+ return guest_role_.get(); |
+} |
+ |
+content::BrowserPluginHostEmbedderRole* WebContentsImpl::GetEmbedderRole() { |
+ return embedder_role_.get(); |
+} |