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

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: Fix Charlie's nits 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..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) {

Powered by Google App Engine
This is Rietveld 408576698