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

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

Issue 293013: Deprecate PathService::Get(..., wstring*) and use FilePath instead. (Closed)
Patch Set: Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Assert that we are not called more than once. Even though calling this 49 // Assert that we are not called more than once. Even though calling this
50 // function isn't harmful (ICU can handle it), being called twice probably 50 // function isn't harmful (ICU can handle it), being called twice probably
51 // indicates a programming error. 51 // indicates a programming error.
52 static bool called_once = false; 52 static bool called_once = false;
53 DCHECK(!called_once); 53 DCHECK(!called_once);
54 called_once = true; 54 called_once = true;
55 #endif 55 #endif
56 56
57 #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) 57 #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED)
58 // We expect to find the ICU data module alongside the current module. 58 // We expect to find the ICU data module alongside the current module.
59 std::wstring data_path; 59 FilePath data_path;
60 PathService::Get(base::DIR_MODULE, &data_path); 60 PathService::Get(base::DIR_MODULE, &data_path);
61 file_util::AppendToPath(&data_path, 61 data_path = data_path.Append(ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME));
tony 2009/10/19 22:46:49 Nit: AppendASCII?
62 ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME));
63 62
64 HMODULE module = LoadLibrary(data_path.c_str()); 63 HMODULE module = LoadLibrary(data_path.value().c_str());
65 if (!module) { 64 if (!module) {
66 LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME; 65 LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME;
67 return false; 66 return false;
68 } 67 }
69 68
70 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL); 69 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
71 if (!addr) { 70 if (!addr) {
72 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in " 71 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in "
73 << ICU_UTIL_DATA_SHARED_MODULE_NAME; 72 << ICU_UTIL_DATA_SHARED_MODULE_NAME;
74 return false; 73 return false;
(...skipping 15 matching lines...) Expand all
90 u_setDataDirectory(data_path.value().c_str()); 89 u_setDataDirectory(data_path.value().c_str());
91 // Only look for the packaged data file; 90 // Only look for the packaged data file;
92 // the default behavior is to look for individual files. 91 // the default behavior is to look for individual files.
93 UErrorCode err = U_ZERO_ERROR; 92 UErrorCode err = U_ZERO_ERROR;
94 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err); 93 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
95 return err == U_ZERO_ERROR; 94 return err == U_ZERO_ERROR;
96 #endif 95 #endif
97 } 96 }
98 97
99 } // namespace icu_util 98 } // namespace icu_util
OLDNEW
« no previous file with comments | « base/base_paths_win.cc ('k') | base/path_service.h » ('j') | chrome/browser/user_data_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698