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

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: Rebase 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 2188455fa56292686368d2f20e6aa6153d342cbe..36462c0bbb1ae5dec4d07b7f8b1f60d0270a64d9 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1132,6 +1132,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) {
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698