diff options
author | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-07 18:58:25 +0000 |
---|---|---|
committer | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-07 18:58:25 +0000 |
commit | 1a290104b9cbdbdd664798b53bddcfc416acb141 (patch) | |
tree | 93893c6c5a17080bc72d490d80a1dbcc0b38e9f7 /content/browser/browser_plugin/browser_plugin_embedder.cc | |
parent | bca6ab997a6e5b79f6d3ef37016c947185794433 (diff) | |
download | chromium_src-1a290104b9cbdbdd664798b53bddcfc416acb141.zip chromium_src-1a290104b9cbdbdd664798b53bddcfc416acb141.tar.gz chromium_src-1a290104b9cbdbdd664798b53bddcfc416acb141.tar.bz2 |
DevTools: Fix Inspect Element action for OOP iframes.
RenderViewContextMenu has recently become aware of the frame it is being called for. This makes it possible direct the InspectElement message to the correct renderer which is necessary of the "Inspect Element" action to work correctly with OOP iframes.
This automatically works correctly for BrowserPlugin as well, so WebContents::GetRenderViewHostAtPosition and all supporting code across can be removed now.
BUG=345700
Review URL: https://codereview.chromium.org/187673004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_embedder.cc')
-rw-r--r-- | content/browser/browser_plugin/browser_plugin_embedder.cc | 52 |
1 files changed, 1 insertions, 51 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc index 2133f01..0c3d914 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.cc +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc @@ -31,12 +31,10 @@ namespace content { BrowserPluginHostFactory* BrowserPluginEmbedder::factory_ = NULL; BrowserPluginEmbedder::BrowserPluginEmbedder(WebContentsImpl* web_contents) - : WebContentsObserver(web_contents), - next_get_render_view_request_id_(0) { + : WebContentsObserver(web_contents) { } BrowserPluginEmbedder::~BrowserPluginEmbedder() { - CleanUp(); } // static @@ -63,18 +61,6 @@ void BrowserPluginEmbedder::StartDrag(BrowserPluginGuest* guest) { guest_started_drag_ = guest->AsWeakPtr(); } -void BrowserPluginEmbedder::GetRenderViewHostAtPosition( - int x, int y, const WebContents::GetRenderViewHostCallback& callback) { - // Store the callback so we can call it later when we have the response. - pending_get_render_view_callbacks_.insert( - std::make_pair(next_get_render_view_request_id_, callback)); - Send(new BrowserPluginMsg_PluginAtPositionRequest( - routing_id(), - next_get_render_view_request_id_, - gfx::Point(x, y))); - ++next_get_render_view_request_id_; -} - WebContentsImpl* BrowserPluginEmbedder::GetWebContents() { return static_cast<WebContentsImpl*>(web_contents()); } @@ -128,18 +114,12 @@ void BrowserPluginEmbedder::SetZoomLevel(double level) { level)); } -void BrowserPluginEmbedder::RenderProcessGone(base::TerminationStatus status) { - CleanUp(); -} - bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message) IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID, OnAllocateInstanceID) IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach) - IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse, - OnPluginAtPositionResponse) IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor(&handled)); IPC_MESSAGE_UNHANDLED(handled = false) @@ -181,13 +161,6 @@ void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) { *handled = (guest_dragging_over_.get() != NULL); } -void BrowserPluginEmbedder::CleanUp() { - // CleanUp gets called when BrowserPluginEmbedder's WebContents goes away - // or the associated RenderViewHost is destroyed or swapped out. Therefore we - // don't need to care about the pending callbacks anymore. - pending_get_render_view_callbacks_.clear(); -} - BrowserPluginGuestManager* BrowserPluginEmbedder::GetBrowserPluginGuestManager() { BrowserPluginGuestManager* guest_manager = @@ -246,27 +219,4 @@ void BrowserPluginEmbedder::OnAttach( } } -void BrowserPluginEmbedder::OnPluginAtPositionResponse( - int instance_id, int request_id, const gfx::Point& position) { - const std::map<int, WebContents::GetRenderViewHostCallback>::iterator - callback_iter = pending_get_render_view_callbacks_.find(request_id); - if (callback_iter == pending_get_render_view_callbacks_.end()) - return; - - RenderViewHost* render_view_host; - BrowserPluginGuest* guest = NULL; - if (instance_id != browser_plugin::kInstanceIDNone) { - guest = GetBrowserPluginGuestManager()->GetGuestByInstanceID( - instance_id, GetWebContents()->GetRenderProcessHost()->GetID()); - } - - if (guest) - render_view_host = guest->GetWebContents()->GetRenderViewHost(); - else // No plugin, use embedder's RenderViewHost. - render_view_host = GetWebContents()->GetRenderViewHost(); - - callback_iter->second.Run(render_view_host, position.x(), position.y()); - pending_get_render_view_callbacks_.erase(callback_iter); -} - } // namespace content |