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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1394383002: OOPIF: Send page-level focus messages to all processes rendering a page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 2 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
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index e19b9fa3212da70629e2d0e8f8c9ed8b1fc4e978..94ca8d238cfab28145e6e2dac5b026151c37d65e 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -32,6 +32,7 @@
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/frame_messages.h"
+#include "content/common/input_messages.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h"
#include "content/public/browser/content_browser_client.h"
@@ -83,6 +84,12 @@ bool OpenerForFrameTreeNode(
return true;
}
+bool CollectSiteInstances(std::set<SiteInstance*>* set,
Charlie Reis 2015/10/16 18:56:09 nit: Add comment about what this is useful for (e.
alexmos 2015/10/16 22:56:05 Done.
+ FrameTreeNode* node) {
+ set->insert(node->current_frame_host()->GetSiteInstance());
+ return true;
+}
+
} // namespace
// A helper class to hold all frame proxies and register as a
@@ -1992,6 +1999,28 @@ void RenderFrameHostManager::SetRWHViewForInnerContents(
GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv);
}
+void RenderFrameHostManager::ReplicatePageFocus(bool is_focused) {
+ CHECK(frame_tree_node_->IsMainFrame());
+
+ std::set<SiteInstance*> frame_tree_site_instances;
+ frame_tree_node_->frame_tree()->ForEach(
+ base::Bind(&CollectSiteInstances, &frame_tree_site_instances));
+
+ for (const auto& instance : frame_tree_site_instances) {
+ if (instance == render_frame_host_->GetSiteInstance())
+ continue;
+
+ // Main frame should have proxies in all SiteInstances of other frames in
Charlie Reis 2015/10/16 18:56:09 nit: Notify the proxies for all SiteInstances of o
alexmos 2015/10/16 22:56:05 Done.
+ // this FrameTree. Note that it might also contain proxies in SiteInstances
+ // for a frame in a different FrameTree (e.g., for window.open), so we
+ // can't just iterate over proxy_hosts_.
Charlie Reis 2015/10/16 18:56:09 This comment should go above line 2005.
alexmos 2015/10/16 22:56:05 Done.
+ RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
+ CHECK(proxy);
+
+ proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
+ }
+}
+
bool RenderFrameHostManager::InitRenderView(
RenderViewHostImpl* render_view_host,
int proxy_routing_id) {

Powered by Google App Engine
This is Rietveld 408576698