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

Unified Diff: chrome/browser/navigation_entry.cc

Issue 8973: Unescape and use the filename when we have no title to display for a given en... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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/navigation_entry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/navigation_entry.cc
===================================================================
--- chrome/browser/navigation_entry.cc (revision 4245)
+++ chrome/browser/navigation_entry.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/navigation_entry.h"
#include "chrome/common/resource_bundle.h"
+#include "net/base/escape.h"
// Use this to get a new unique ID for a NavigationEntry during construction.
// The returned ID is guaranteed to be nonzero (which is the "no ID" indicator).
@@ -58,7 +59,11 @@
}
const std::wstring& NavigationEntry::GetTitleForDisplay() {
- if (title_.empty())
- return url_as_string_;
+ if (title_.empty()) {
+ title_ = UTF8ToWide(url_.ExtractFileName().empty() ?
+ url_.spec() :
+ UnescapeURLComponent(url_.ExtractFileName(),
+ UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS));
+ }
return title_;
}
« no previous file with comments | « chrome/browser/navigation_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698