Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2438)

Unified Diff: base/i18n/file_util_icu.cc

Issue 447403002: Move file_util_icu to base::i18n namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/i18n/file_util_icu.h ('k') | base/i18n/file_util_icu_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/file_util_icu.cc
diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc
index e250c29a5f7d013f29c981d6fadb507c5c2756f9..b5c0b9d8f5f9f661c5c7965bdb6fbb1e39639ed5 100644
--- a/base/i18n/file_util_icu.cc
+++ b/base/i18n/file_util_icu.cc
@@ -19,7 +19,8 @@
#include "third_party/icu/source/common/unicode/uniset.h"
#include "third_party/icu/source/i18n/unicode/coll.h"
-using base::string16;
+namespace base {
+namespace i18n {
namespace {
@@ -84,20 +85,18 @@ IllegalCharacters::IllegalCharacters() {
} // namespace
-namespace file_util {
-
bool IsFilenameLegal(const string16& file_name) {
return IllegalCharacters::GetInstance()->containsNone(file_name);
}
-void ReplaceIllegalCharactersInPath(base::FilePath::StringType* file_name,
+void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
char replace_char) {
DCHECK(file_name);
DCHECK(!(IllegalCharacters::GetInstance()->contains(replace_char)));
// Remove leading and trailing whitespace.
- base::TrimWhitespace(*file_name, base::TRIM_ALL, file_name);
+ TrimWhitespace(*file_name, TRIM_ALL, file_name);
IllegalCharacters* illegal = IllegalCharacters::GetInstance();
int cursor = 0; // The ICU macros expect an int.
@@ -133,8 +132,7 @@ void ReplaceIllegalCharactersInPath(base::FilePath::StringType* file_name,
}
}
-bool LocaleAwareCompareFilenames(const base::FilePath& a,
- const base::FilePath& b) {
+bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b) {
UErrorCode error_code = U_ZERO_ERROR;
// Use the default collator. The default locale should have been properly
// set by the time this constructor is called.
@@ -144,31 +142,31 @@ bool LocaleAwareCompareFilenames(const base::FilePath& a,
collator->setStrength(icu::Collator::TERTIARY);
#if defined(OS_WIN)
- return base::i18n::CompareString16WithCollator(collator.get(),
- base::WideToUTF16(a.value()), base::WideToUTF16(b.value())) == UCOL_LESS;
+ return CompareString16WithCollator(collator.get(),
+ WideToUTF16(a.value()), WideToUTF16(b.value())) == UCOL_LESS;
#elif defined(OS_POSIX)
// On linux, the file system encoding is not defined. We assume
// SysNativeMBToWide takes care of it.
- return base::i18n::CompareString16WithCollator(
+ return CompareString16WithCollator(
collator.get(),
- base::WideToUTF16(base::SysNativeMBToWide(a.value().c_str())),
- base::WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))
- ) == UCOL_LESS;
+ WideToUTF16(SysNativeMBToWide(a.value().c_str())),
+ WideToUTF16(SysNativeMBToWide(b.value().c_str()))) == UCOL_LESS;
#else
#error Not implemented on your system
#endif
}
-void NormalizeFileNameEncoding(base::FilePath* file_name) {
+void NormalizeFileNameEncoding(FilePath* file_name) {
#if defined(OS_CHROMEOS)
std::string normalized_str;
- if (base::ConvertToUtf8AndNormalize(file_name->BaseName().value(),
- base::kCodepageUTF8,
- &normalized_str)) {
- *file_name = file_name->DirName().Append(base::FilePath(normalized_str));
+ if (ConvertToUtf8AndNormalize(file_name->BaseName().value(),
+ kCodepageUTF8,
+ &normalized_str)) {
+ *file_name = file_name->DirName().Append(FilePath(normalized_str));
}
#endif
}
-} // namespace
+} // namespace i18n
+} // namespace base
« no previous file with comments | « base/i18n/file_util_icu.h ('k') | base/i18n/file_util_icu_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698