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..8766b33fc03f449929218455ac3edd712b67e9ed 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,15 @@ bool OpenerForFrameTreeNode( |
return true; |
} |
+// Helper function that can be used with FrameTree::ForEach to collect |
+// SiteInstances involved in rendering a page, which is a subset of those in |
+// proxy_hosts_ because of openers. |
+bool CollectSiteInstances(std::set<SiteInstance*>* set, |
+ 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 +2002,28 @@ void RenderFrameHostManager::SetRWHViewForInnerContents( |
GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv); |
} |
+void RenderFrameHostManager::ReplicatePageFocus(bool is_focused) { |
nasko
2015/10/16 21:43:44
This doesn't seem to logically belong in this clas
Charlie Reis
2015/10/16 22:03:26
I could see this going either way. It's broadcast
alexmos
2015/10/16 22:56:06
Good suggestion -- moved to FrameTree.
|
+ 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)); |
+ |
+ // Notify the proxies for all SiteInstances of other frames in this |
+ // FrameTree. Note that the main frame might also know about proxies in |
+ // SiteInstances for a frame in a different FrameTree (e.g., for |
+ // window.open), so we can't just iterate over proxy_hosts_. |
+ for (const auto& instance : frame_tree_site_instances) { |
+ if (instance == render_frame_host_->GetSiteInstance()) |
+ continue; |
+ |
+ RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
+ CHECK(proxy); |
nasko
2015/10/16 21:44:21
No need to CHECK here, as it will crash on the nex
alexmos
2015/10/16 22:56:06
Done.
|
+ |
+ proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
+ } |
+} |
+ |
bool RenderFrameHostManager::InitRenderView( |
RenderViewHostImpl* render_view_host, |
int proxy_routing_id) { |