summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/navigation_controller.cc
diff options
context:
space:
mode:
authormhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 02:16:32 +0000
committermhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 02:16:32 +0000
commita23de85783d944cbb75f09737eb29c60ea87481d (patch)
tree30c4732b42443259134a3f83f574bfaa2a506292 /chrome/browser/tab_contents/navigation_controller.cc
parent1b5237ecc1fea39e51e1634acbcdf11bd7ef57b0 (diff)
downloadchromium_src-a23de85783d944cbb75f09737eb29c60ea87481d.zip
chromium_src-a23de85783d944cbb75f09737eb29c60ea87481d.tar.gz
chromium_src-a23de85783d944cbb75f09737eb29c60ea87481d.tar.bz2
Local text file with spaces in filename is urlencoded in tab title
When viewing a local text file with spaces in filename, it is still urlencoded. Filename should be displayed with spaces, not with urlencoding. It would be more user-friendly. Since net::FormatURL is already implemented, using it would be great. But it doesn't escape SPACES, just NORMAL, it doesn't even escape unicode. I plumbed out a unescapeurl that could be used whether we allow conversion of spaces or not. BUG=8775 (http://crbug.com/8775) TEST=Tested whether the input is escaped in the navigational context and ran the net tests New Review: http://codereview.chromium.org/118059 Review URL: http://codereview.chromium.org/56053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/navigation_controller.cc')
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index 2a30087..076d525 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -18,9 +18,13 @@
#include "chrome/browser/tab_contents/site_instance.h"
#include "chrome/common/navigation_types.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
+#include "net/base/escape.h"
+#include "net/base/net_util.h"
#include "webkit/glue/webkit_glue.h"
#if defined(OS_WIN)
@@ -354,8 +358,10 @@ NavigationEntry* NavigationController::CreateNavigationEntry(
entry->set_display_url(url);
entry->set_user_typed_url(url);
if (url.SchemeIsFile()) {
+ std::wstring languages = profile()->GetPrefs()->GetString(
+ prefs::kAcceptLanguages);
entry->set_title(WideToUTF16Hack(
- file_util::GetFilenameFromPath(UTF8ToWide(url.host() + url.path()))));
+ file_util::GetFilenameFromPath(net::FormatUrl(url, languages))));
}
return entry;
}