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

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

Issue 2754363002: Don't focus the omnibox when a subframe navigates on NTP (Merge to M58) (Closed)
Patch Set: Created 3 years, 9 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 | « chrome/browser/extensions/extension_override_apitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 de21bd41582cc8213d14c4aab131afa2e2cd0a78..09681354741acc619163c1d09bdaef3757d0e072 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -2173,11 +2173,16 @@ void RenderFrameHostManager::CommitPending() {
"FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
DCHECK(pending_render_frame_host_ || speculative_render_frame_host_);
+ bool is_main_frame = frame_tree_node_->IsMainFrame();
+
// First check whether we're going to want to focus the location bar after
// this commit. We do this now because the navigation hasn't formally
// committed yet, so if we've already cleared the pending WebUI the call chain
- // this triggers won't be able to figure out what's going on.
- bool will_focus_location_bar = delegate_->FocusLocationBarByDefault();
+ // this triggers won't be able to figure out what's going on. Note that
+ // subframe commits should not be allowed to steal focus from the main frame
+ // by focusing the location bar (see https://crbug.com/700124).
+ bool will_focus_location_bar =
+ is_main_frame && delegate_->FocusLocationBarByDefault();
// Remember if the page was focused so we can focus the new renderer in
// that case.
@@ -2185,8 +2190,6 @@ void RenderFrameHostManager::CommitPending() {
render_frame_host_->GetView() &&
render_frame_host_->GetView()->HasFocus();
- bool is_main_frame = frame_tree_node_->IsMainFrame();
-
// While the old frame is still current, remove its children from the tree.
frame_tree_node_->ResetForNewProcess();
« no previous file with comments | « chrome/browser/extensions/extension_override_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698