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

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

Issue 1568363002: [iOS] Allow overriding icuctl.dat file location. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rohit comments Created 4 years, 11 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
« no previous file with comments | « no previous file | base/ios/ios_util.h » ('j') | base/ios/ios_util.mm » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/ios/ios_util.h » ('j') | base/ios/ios_util.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698