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 94df090221ae2fabae005fd6d8004bff6cbe7e24..94d2416db62c5e57bc6ea87862edd8ee80e14ba5 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -2920,9 +2920,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); |
} |