OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/i18n/icu_util.h" | 5 #include "base/i18n/icu_util.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "third_party/icu/source/common/unicode/putil.h" | 21 #include "third_party/icu/source/common/unicode/putil.h" |
22 #include "third_party/icu/source/common/unicode/udata.h" | 22 #include "third_party/icu/source/common/unicode/udata.h" |
23 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 23 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
24 #include "third_party/icu/source/i18n/unicode/timezone.h" | 24 #include "third_party/icu/source/i18n/unicode/timezone.h" |
25 #endif | 25 #endif |
26 | 26 |
27 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
28 #include "base/android/apk_assets.h" | 28 #include "base/android/apk_assets.h" |
29 #endif | 29 #endif |
30 | 30 |
| 31 #if defined(OS_IOS) |
| 32 #include "base/ios/ios_util.h" |
| 33 #endif |
| 34 |
31 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
32 #include "base/mac/foundation_util.h" | 36 #include "base/mac/foundation_util.h" |
33 #endif | 37 #endif |
34 | 38 |
35 #define ICU_UTIL_DATA_FILE 0 | 39 #define ICU_UTIL_DATA_FILE 0 |
36 #define ICU_UTIL_DATA_SHARED 1 | 40 #define ICU_UTIL_DATA_SHARED 1 |
37 #define ICU_UTIL_DATA_STATIC 2 | 41 #define ICU_UTIL_DATA_STATIC 2 |
38 | 42 |
39 namespace base { | 43 namespace base { |
40 namespace i18n { | 44 namespace i18n { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 wchar_t tmp_buffer2[_MAX_PATH] = {0}; | 121 wchar_t tmp_buffer2[_MAX_PATH] = {0}; |
118 wcscpy_s(tmp_buffer2, data_path.value().c_str()); | 122 wcscpy_s(tmp_buffer2, data_path.value().c_str()); |
119 debug::Alias(tmp_buffer2); | 123 debug::Alias(tmp_buffer2); |
120 #endif | 124 #endif |
121 | 125 |
122 #else | 126 #else |
123 // Assume it is in the framework bundle's Resources directory. | 127 // Assume it is in the framework bundle's Resources directory. |
124 ScopedCFTypeRef<CFStringRef> data_file_name( | 128 ScopedCFTypeRef<CFStringRef> data_file_name( |
125 SysUTF8ToCFStringRef(kIcuDataFileName)); | 129 SysUTF8ToCFStringRef(kIcuDataFileName)); |
126 FilePath data_path = mac::PathForFrameworkBundleResource(data_file_name); | 130 FilePath data_path = mac::PathForFrameworkBundleResource(data_file_name); |
| 131 #if defined(OS_IOS) |
| 132 FilePath override_data_path = base::ios::FilePathOfEmbeddedICU(); |
| 133 if (!override_data_path.empty()) { |
| 134 data_path = override_data_path; |
| 135 } |
| 136 #endif // !defined(OS_IOS) |
127 if (data_path.empty()) { | 137 if (data_path.empty()) { |
128 LOG(ERROR) << kIcuDataFileName << " not found in bundle"; | 138 LOG(ERROR) << kIcuDataFileName << " not found in bundle"; |
129 return; | 139 return; |
130 } | 140 } |
131 #endif // !defined(OS_MACOSX) | 141 #endif // !defined(OS_MACOSX) |
132 File file(data_path, File::FLAG_OPEN | File::FLAG_READ); | 142 File file(data_path, File::FLAG_OPEN | File::FLAG_READ); |
133 if (file.IsValid()) { | 143 if (file.IsValid()) { |
134 g_icudtl_pf = file.TakePlatformFile(); | 144 g_icudtl_pf = file.TakePlatformFile(); |
135 g_icudtl_region = MemoryMappedFile::Region::kWholeFile; | 145 g_icudtl_region = MemoryMappedFile::Region::kWholeFile; |
136 } | 146 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 #endif // !defined(OS_NACL) | 275 #endif // !defined(OS_NACL) |
266 | 276 |
267 void AllowMultipleInitializeCallsForTesting() { | 277 void AllowMultipleInitializeCallsForTesting() { |
268 #if !defined(NDEBUG) && !defined(OS_NACL) | 278 #if !defined(NDEBUG) && !defined(OS_NACL) |
269 g_check_called_once = false; | 279 g_check_called_once = false; |
270 #endif | 280 #endif |
271 } | 281 } |
272 | 282 |
273 } // namespace i18n | 283 } // namespace i18n |
274 } // namespace base | 284 } // namespace base |
OLD | NEW |