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 58fc9d2d4cf14365137590e9204cbe7462f12e2d..42c0f997cccb1bfdf038b2b8242614dbbfeec5af 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -2932,9 +2932,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. |
Peter Kasting
2016/03/03 21:02:19
Nit: I'd prefer to explain sufficiently inline tha
palmer
2016/03/04 22:15:57
Done.
|
+ NavigationEntryImpl* entry = controller_.GetPendingEntry(); |
+ if (controller_.IsInitialNavigation() && entry && |
+ !entry->is_renderer_initiated() && |
+ entry->GetURL() == GURL(url::kAboutBlankURL)) { |
return true; |
+ } |
return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); |
} |