diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-01 22:57:52 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-01 22:57:52 +0000 |
commit | 04c989443019bb446419ad28ba4d83c97b2cb7bf (patch) | |
tree | b5176e0b1f5bf65074188e4f1f7fcb86e8f26206 /chrome/browser/navigation_entry.cc | |
parent | a675e5364c7f5fea5d8b186d5f763e9132bd69ae (diff) | |
download | chromium_src-04c989443019bb446419ad28ba4d83c97b2cb7bf.zip chromium_src-04c989443019bb446419ad28ba4d83c97b2cb7bf.tar.gz chromium_src-04c989443019bb446419ad28ba4d83c97b2cb7bf.tar.bz2 |
Unescape and use the filename when we have no title to display for a given entry (instead of displaying the whole path). This unifies the display of titles for local and remote files.
For anyone watching, this is how tab titles will change:
'http://blah.com/index.html' will be 'index.html'
'http://blah.com/meat%20pie.pdf' will be 'meat pie.pdf'
'file://C:/blah/blue%20cheese.txt' will be 'blue cheese.txt' (previously this sometimes changed between the URL and blue%20cheese.txt depending on how the file was opened).
BUG=2529,2375
Review URL: http://codereview.chromium.org/8973
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/navigation_entry.cc')
-rw-r--r-- | chrome/browser/navigation_entry.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/navigation_entry.cc b/chrome/browser/navigation_entry.cc index f7ed6c6..18992d6 100644 --- a/chrome/browser/navigation_entry.cc +++ b/chrome/browser/navigation_entry.cc @@ -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,12 @@ NavigationEntry::NavigationEntry(TabContentsType type, } const std::wstring& NavigationEntry::GetTitleForDisplay() { - if (title_.empty()) - return url_as_string_; + if (title_.empty()) { + std::string filename = url_.ExtractFileName(); + title_ = UTF8ToWide(filename.empty() ? + url_.spec() : + UnescapeURLComponent(filename, UnescapeRule::SPACES | + UnescapeRule::URL_SPECIAL_CHARS)); + } return title_; }
\ No newline at end of file |