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

Unified Diff: chrome/browser/tab_contents/navigation_controller.cc

Issue 2861042: Deprecate more old filepath functions. (Closed)
Patch Set: Created 10 years, 6 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 | « base/file_util_unittest.cc ('k') | views/drag_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/navigation_controller.cc
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index 6efd34351909ba0ff62c9ee8836387e522bb1e28..5b0e157bbbaec1425aa8b7bd03c3ff361aafd747 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -255,10 +255,15 @@ NavigationEntry* NavigationController::CreateNavigationEntry(
entry->set_user_typed_url(url);
entry->set_update_virtual_url_with_url(reverse_on_redirect);
if (url.SchemeIsFile()) {
+ // Use the filename as the title, not the full path.
+ // We need to call FormatUrl() to perform URL de-escaping;
+ // it's a bit ugly to grab the filename out of the resulting string.
std::wstring languages = UTF8ToWide(profile->GetPrefs()->GetString(
prefs::kAcceptLanguages));
- entry->set_title(WideToUTF16Hack(
- file_util::GetFilenameFromPath(net::FormatUrl(url, languages))));
+ std::wstring formatted = net::FormatUrl(url, languages);
+ std::wstring filename =
+ FilePath::FromWStringHack(formatted).BaseName().ToWStringHack();
+ entry->set_title(WideToUTF16Hack(filename));
}
return entry;
}
« no previous file with comments | « base/file_util_unittest.cc ('k') | views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698