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

Unified Diff: content/browser/tab_contents/navigation_entry.cc

Issue 6591127: fix display of filenames in file:/// URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: whitespace Created 9 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/tab_contents/navigation_entry.cc
diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry.cc
index ec35a9f12325e2d990d939f97232ea0f2face00a..535f46314957e4bb483059a92c0d2893af3c1cb8 100644
--- a/content/browser/tab_contents/navigation_entry.cc
+++ b/content/browser/tab_contents/navigation_entry.cc
@@ -94,6 +94,14 @@ const string16& NavigationEntry::GetTitleForDisplay(
} else if (!url_.is_empty()) {
title = net::FormatUrl(url_, languages);
}
+
+ // For file:// URLs use the filename as the title, not the full path.
+ if (url_.SchemeIsFile()) {
+ string16::size_type slashpos = title.rfind('/');
+ if (slashpos != string16::npos)
+ title = title.substr(slashpos + 1);
+ }
+
ui::ElideString(title, chrome::kMaxTitleChars, &cached_display_title_);
return cached_display_title_;
}
« no previous file with comments | « content/browser/tab_contents/navigation_controller.cc ('k') | content/browser/tab_contents/navigation_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698