summaryrefslogtreecommitdiffstats
path: root/base/i18n/file_util_icu.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 23:06:12 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 23:06:12 +0000
commitde29433580baeecc204edc9ca0c2aa47c51aa93a (patch)
treeec55f655f63f7e09fb373c1e7d784c2e721c6119 /base/i18n/file_util_icu.h
parent2c1639589b5932b565c9d420cb79b56a4212a706 (diff)
downloadchromium_src-de29433580baeecc204edc9ca0c2aa47c51aa93a.zip
chromium_src-de29433580baeecc204edc9ca0c2aa47c51aa93a.tar.gz
chromium_src-de29433580baeecc204edc9ca0c2aa47c51aa93a.tar.bz2
Do some cleanup of file path name handling.
This started trying to cleanup DownloadManager::GenerateFilename which asserts if your system locale isn't UTF-8 (I ran into this when mine got messed up). The solution is to have GetSuggestedFilename return a FilePath rather than calling FromWStringHack. The rest of the patch is a result of trying to write GetSuggestedFilename in a reasonable way. I changed ReplaceIllegalCharacters to work on a FilePath::StringType. Some places in the code calling these functions got cleaner, some got messier. I think overall the ones that got messier are the ones doing sketchy things with paths and the ones that got cleaner are the ones doing things more properly. The only code here that gets called a nontrivial number of times is the weburlloader, and I think the new code does about the same number of string conversions overall (though on certain platforms the number will be higher or lower). BUG=none TEST=none Review URL: http://codereview.chromium.org/271056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n/file_util_icu.h')
-rw-r--r--base/i18n/file_util_icu.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/base/i18n/file_util_icu.h b/base/i18n/file_util_icu.h
index c309a9e..54ddb08 100644
--- a/base/i18n/file_util_icu.h
+++ b/base/i18n/file_util_icu.h
@@ -6,6 +6,7 @@
#include <string>
+#include "base/file_path.h"
#include "base/string16.h"
class FilePath;
@@ -18,12 +19,13 @@ bool IsFilenameLegal(const string16& file_name);
// Replaces characters in 'file_name' that are illegal for file names with
// 'replace_char'. 'file_name' must not be a full or relative path, but just the
-// file name component. Any leading or trailing whitespace in 'file_name' is
-// removed.
+// file name component (since slashes are considered illegal). Any leading or
+// trailing whitespace in 'file_name' is removed.
// Example:
// file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
// 'replace_char' is '-'.
-void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
+void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
+ char replace_char);
// Compares two filenames using the current locale information. This can be
// used to sort directory listings. It behaves like "operator<" for use in