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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1678233003: Don't focus the location bar in a phishy situation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for load in the WC returned by GetActiveWebContents Created 4 years, 10 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
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);
}
« chrome/browser/ui/browser_focus_uitest.cc ('K') | « chrome/browser/ui/browser_focus_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698