| Index: chrome/browser/file_select_helper.h
|
| diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h
|
| index 0067b8a11c5c4b804068fa930a83f4ce4089c568..f3f1266b437efd657dbb5c640c7e4b9ede214def 100644
|
| --- a/chrome/browser/file_select_helper.h
|
| +++ b/chrome/browser/file_select_helper.h
|
| @@ -51,6 +51,7 @@ class FileSelectHelper : public base::RefCountedThreadSafe<FileSelectHelper>,
|
| friend class base::RefCountedThreadSafe<FileSelectHelper>;
|
| FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, IsAcceptTypeValid);
|
| FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, ZipPackage);
|
| + FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, GetSanitizedFileName);
|
| explicit FileSelectHelper(Profile* profile);
|
| ~FileSelectHelper() override;
|
|
|
| @@ -177,6 +178,22 @@ class FileSelectHelper : public base::RefCountedThreadSafe<FileSelectHelper>,
|
| // no whitespace.
|
| static bool IsAcceptTypeValid(const std::string& accept_type);
|
|
|
| + // Get a sanitized filename suitable for use as a default filename. The
|
| + // suggested filename coming over the IPC may contain invalid characters or
|
| + // may result in a filename that's reserved on the current platform.
|
| + //
|
| + // If |suggested_path| is empty, the return value is also empty.
|
| + //
|
| + // If |suggested_path| is non-empty, but can't be safely converted to UTF-8,
|
| + // or is entirely lost during the sanitization process (e.g. because it
|
| + // consists entirely of invalid characters), it's replaced with a default
|
| + // filename.
|
| + //
|
| + // Otherwise, returns |suggested_path| with any invalid characters will be
|
| + // replaced with a suitable replacement character.
|
| + static base::FilePath GetSanitizedFileName(
|
| + const base::FilePath& suggested_path);
|
| +
|
| // Profile used to set/retrieve the last used directory.
|
| Profile* profile_;
|
|
|
|
|