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

Side by Side Diff: base/i18n/file_util_icu.cc

Issue 9854011: Normalize download file name on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // File utilities that use the ICU library go in this file. 5 // File utilities that use the ICU library go in this file.
6 6
7 #include "base/i18n/file_util_icu.h" 7 #include "base/i18n/file_util_icu.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/i18n/icu_string_conversions.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "base/sys_string_conversions.h" 16 #include "base/sys_string_conversions.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "unicode/coll.h" 18 #include "unicode/coll.h"
18 #include "unicode/uniset.h" 19 #include "unicode/uniset.h"
19 20
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // strings to UTF-16 ourselves to ensure conversion consistency. 193 // strings to UTF-16 ourselves to ensure conversion consistency.
193 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16? 194 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16?
194 return LocaleAwareComparator::GetInstance()->Compare( 195 return LocaleAwareComparator::GetInstance()->Compare(
195 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), 196 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())),
196 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0; 197 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0;
197 #else 198 #else
198 #error Not implemented on your system 199 #error Not implemented on your system
199 #endif 200 #endif
200 } 201 }
201 202
203 void NormalizeFileNameEncoding(FilePath* file_name) {
204 #if defined(OS_CHROMEOS)
205 std::string normalized_str;
206 if (base::ConvertToUtf8AndNormalize(file_name->BaseName().value(),
207 base::kCodepageUTF8,
208 &normalized_str)) {
209 *file_name = file_name->DirName().Append(FilePath(normalized_str));
210 }
211 #endif
212 }
213
202 } // namespace 214 } // namespace
OLDNEW
« 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