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

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

Issue 1406103005: Preserve page-level focus for subframe cross-process navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus-page
Patch Set: Add comment 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
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index ac61afa5240b7d354ad2e4f6b558483f6fb19930..cddea8333fd214ee43851fa0ee1f71b77b8d8bae 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -429,12 +429,18 @@ void FrameTree::ReplicatePageFocus(bool is_focused) {
// about proxies in SiteInstances for frames in a different FrameTree (e.g.,
// for window.open), so we can't just iterate over its proxy_hosts_ in
// RenderFrameHostManager.
- for (const auto& instance : frame_tree_site_instances) {
- if (instance == root_->current_frame_host()->GetSiteInstance())
- continue;
+ for (const auto& instance : frame_tree_site_instances)
+ SetPageFocus(instance, is_focused);
+}
+
+void FrameTree::SetPageFocus(SiteInstance* instance, bool is_focused) {
+ RenderFrameHostManager* root_manager = root_->render_manager();
+ // This is only used to set page-level focus in cross-process subframes, and
+ // requests to set focus in main frame's SiteInstance are ignored.
+ if (instance != root_manager->current_frame_host()->GetSiteInstance()) {
RenderFrameProxyHost* proxy =
- root_->render_manager()->GetRenderFrameProxyHost(instance);
+ root_manager->GetRenderFrameProxyHost(instance);
proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
}
}
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698