Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index e02c77031447bd168bd78da1759ae6fdceb488a9..e1a3cdfe5c160d2b8a1939d4d868ecd0d039554e 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -2913,9 +2913,16 @@ void WebContentsImpl::ResumeLoadingCreatedWebContents() { |
} |
bool WebContentsImpl::FocusLocationBarByDefault() { |
- NavigationEntry* entry = controller_.GetVisibleEntry(); |
- if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) |
+ // If we are starting at about:blank, give the omnibox focus to let the user |
+ // easily edit it. We intentionally check the pending entry rather than the |
+ // visible one, since we don't want to be tricked by non-visible pending URLs. |
+ // See https://crbug.com/567445. |
+ NavigationEntryImpl* entry = controller_.GetPendingEntry(); |
+ if (controller_.IsInitialNavigation() && entry && |
+ !entry->is_renderer_initiated() && |
+ entry->GetURL() == GURL(url::kAboutBlankURL)) { |
return true; |
+ } |
return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); |
} |