OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/simple_resource_loader.h" | 5 #include "chrome_frame/simple_resource_loader.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/win_util.h" | 17 #include "base/win/windows_version.h" |
18 | 18 |
19 const wchar_t kLocalesDirName[] = L"Locales"; | 19 const wchar_t kLocalesDirName[] = L"Locales"; |
20 | 20 |
21 HINSTANCE SimpleResourceLoader::locale_dll_handle_; | 21 HINSTANCE SimpleResourceLoader::locale_dll_handle_; |
22 | 22 |
23 SimpleResourceLoader::SimpleResourceLoader() { | 23 SimpleResourceLoader::SimpleResourceLoader() { |
24 // Find and load the resource DLL. | 24 // Find and load the resource DLL. |
25 std::wstring language; | 25 std::wstring language; |
26 std::wstring region; | 26 std::wstring region; |
27 GetSystemLocale(&language, ®ion); | 27 GetSystemLocale(&language, ®ion); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 } else { | 108 } else { |
109 NOTREACHED() << "Could not locate locales DLL directory."; | 109 NOTREACHED() << "Could not locate locales DLL directory."; |
110 } | 110 } |
111 | 111 |
112 return found_dll; | 112 return found_dll; |
113 } | 113 } |
114 | 114 |
115 HINSTANCE SimpleResourceLoader::LoadLocaleDll(const FilePath& dll_path) { | 115 HINSTANCE SimpleResourceLoader::LoadLocaleDll(const FilePath& dll_path) { |
116 DWORD load_flags = 0; | 116 DWORD load_flags = 0; |
117 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { | 117 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
118 load_flags = LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | | 118 load_flags = LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | |
119 LOAD_LIBRARY_AS_IMAGE_RESOURCE; | 119 LOAD_LIBRARY_AS_IMAGE_RESOURCE; |
120 } else { | 120 } else { |
121 load_flags = DONT_RESOLVE_DLL_REFERENCES; | 121 load_flags = DONT_RESOLVE_DLL_REFERENCES; |
122 } | 122 } |
123 | 123 |
124 // The dll should only have resources, not executable code. | 124 // The dll should only have resources, not executable code. |
125 HINSTANCE locale_dll_handle = LoadLibraryEx(dll_path.value().c_str(), NULL, | 125 HINSTANCE locale_dll_handle = LoadLibraryEx(dll_path.value().c_str(), NULL, |
126 load_flags); | 126 load_flags); |
127 DCHECK(locale_dll_handle != NULL) << "unable to load generated resources: " | 127 DCHECK(locale_dll_handle != NULL) << "unable to load generated resources: " |
(...skipping 27 matching lines...) Expand all Loading... |
155 | 155 |
156 // static | 156 // static |
157 std::wstring SimpleResourceLoader::Get(int message_id) { | 157 std::wstring SimpleResourceLoader::Get(int message_id) { |
158 SimpleResourceLoader* loader = SimpleResourceLoader::instance(); | 158 SimpleResourceLoader* loader = SimpleResourceLoader::instance(); |
159 return loader->GetLocalizedResource(message_id); | 159 return loader->GetLocalizedResource(message_id); |
160 } | 160 } |
161 | 161 |
162 HINSTANCE SimpleResourceLoader::GetResourceModuleHandle() { | 162 HINSTANCE SimpleResourceLoader::GetResourceModuleHandle() { |
163 return locale_dll_handle_; | 163 return locale_dll_handle_; |
164 } | 164 } |
OLD | NEW |