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

Unified Diff: chrome/browser/ui/browser.cc

Issue 232463007: Don't leave aborted URLs in the omnibox unless we're on a new tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix and add tests. Created 6 years, 8 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: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index b353ff26cc82a33f57aaff33a3aa1d81883e205c..70392550a4936dd7e9f98077cd43e06ddcd800f1 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1131,6 +1131,16 @@ bool Browser::CanOverscrollContent() const {
#endif
}
+bool Browser::ShouldPreserveAbortedURLs(WebContents* source) {
+ // Allow failed URLs to stick around in the omnibox on the NTP, but not when
+ // other pages have committed.
+ Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext());
+ if (!profile || !source->GetController().GetLastCommittedEntry())
+ return false;
+ GURL committed_url(source->GetController().GetLastCommittedEntry()->GetURL());
+ return chrome::IsNTPURL(committed_url, profile);
+}
+
bool Browser::PreHandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {

Powered by Google App Engine
This is Rietveld 408576698