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 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Chrome doesn't normally shut down ICU, so the mapped data shouldn't ever | 88 // Chrome doesn't normally shut down ICU, so the mapped data shouldn't ever |
89 // be released. | 89 // be released. |
90 CR_DEFINE_STATIC_LOCAL(base::MemoryMappedFile, mapped_file, ()); | 90 CR_DEFINE_STATIC_LOCAL(base::MemoryMappedFile, mapped_file, ()); |
91 if (!mapped_file.IsValid()) { | 91 if (!mapped_file.IsValid()) { |
92 #if !defined(OS_MACOSX) | 92 #if !defined(OS_MACOSX) |
93 FilePath data_path; | 93 FilePath data_path; |
94 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
95 // The data file will be in the same directory as the current module. | 95 // The data file will be in the same directory as the current module. |
96 bool path_ok = PathService::Get(base::DIR_MODULE, &data_path); | 96 bool path_ok = PathService::Get(base::DIR_MODULE, &data_path); |
| 97 #elif defined(OS_ANDROID) |
| 98 bool path_ok = PathService::Get(base::DIR_ANDROID_APP_DATA, &data_path); |
97 #else | 99 #else |
98 // For now, expect the data file to be alongside the executable. | 100 // For now, expect the data file to be alongside the executable. |
99 // This is sufficient while we work on unit tests, but will eventually | 101 // This is sufficient while we work on unit tests, but will eventually |
100 // likely live in a data directory. | 102 // likely live in a data directory. |
101 bool path_ok = PathService::Get(base::DIR_EXE, &data_path); | 103 bool path_ok = PathService::Get(base::DIR_EXE, &data_path); |
102 #endif | 104 #endif |
103 DCHECK(path_ok); | 105 DCHECK(path_ok); |
104 data_path = data_path.AppendASCII(ICU_UTIL_DATA_FILE_NAME); | 106 data_path = data_path.AppendASCII(ICU_UTIL_DATA_FILE_NAME); |
105 #else | 107 #else |
106 // Assume it is in the framework bundle's Resources directory. | 108 // Assume it is in the framework bundle's Resources directory. |
(...skipping 10 matching lines...) Expand all Loading... |
117 } | 119 } |
118 } | 120 } |
119 UErrorCode err = U_ZERO_ERROR; | 121 UErrorCode err = U_ZERO_ERROR; |
120 udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err); | 122 udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err); |
121 return err == U_ZERO_ERROR; | 123 return err == U_ZERO_ERROR; |
122 #endif | 124 #endif |
123 } | 125 } |
124 | 126 |
125 } // namespace i18n | 127 } // namespace i18n |
126 } // namespace base | 128 } // namespace base |
OLD | NEW |