Make certificate viewer a tab-modal dialog.
[chromium-blink-merge.git] / base / i18n / file_util_icu.h
blob024a927818c8ac948bf68e92fa22fd0c58ef732b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_I18N_FILE_UTIL_ICU_H_
6 #define BASE_I18N_FILE_UTIL_ICU_H_
8 // File utilities that use the ICU library go in this file.
10 #include "base/files/file_path.h"
11 #include "base/i18n/base_i18n_export.h"
12 #include "base/string16.h"
14 namespace file_util {
16 // Returns true if file_name does not have any illegal character. The input
17 // param has the same restriction as that for ReplaceIllegalCharacters.
18 BASE_I18N_EXPORT bool IsFilenameLegal(const string16& file_name);
20 // Replaces characters in 'file_name' that are illegal for file names with
21 // 'replace_char'. 'file_name' must not be a full or relative path, but just the
22 // file name component (since slashes are considered illegal). Any leading or
23 // trailing whitespace in 'file_name' is removed.
24 // Example:
25 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
26 // 'replace_char' is '-'.
27 BASE_I18N_EXPORT void ReplaceIllegalCharactersInPath(
28 base::FilePath::StringType* file_name,
29 char replace_char);
31 // Compares two filenames using the current locale information. This can be
32 // used to sort directory listings. It behaves like "operator<" for use in
33 // std::sort.
34 BASE_I18N_EXPORT bool LocaleAwareCompareFilenames(const base::FilePath& a,
35 const base::FilePath& b);
37 // Calculates the canonical file-system representation of |file_name| base name.
38 // Modifies |file_name| in place. No-op if not on ChromeOS.
39 BASE_I18N_EXPORT void NormalizeFileNameEncoding(base::FilePath* file_name);
41 } // namespace file_util
43 #endif // BASE_I18N_FILE_UTIL_ICU_H_