OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 5 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 FilePath path_; | 200 FilePath path_; |
201 | 201 |
202 DISALLOW_COPY_AND_ASSIGN(LoadedDataPack); | 202 DISALLOW_COPY_AND_ASSIGN(LoadedDataPack); |
203 }; | 203 }; |
204 | 204 |
205 // We define a DataHandle typedef to abstract across how data is stored | 205 // We define a DataHandle typedef to abstract across how data is stored |
206 // across platforms. | 206 // across platforms. |
207 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
208 // Windows stores resources in DLLs, which are managed by HINSTANCE. | 208 // Windows stores resources in DLLs, which are managed by HINSTANCE. |
209 typedef HINSTANCE DataHandle; | 209 typedef HINSTANCE DataHandle; |
210 #elif defined(USE_BASE_DATA_PACK) | 210 #elif defined(OS_POSIX) |
211 // Linux uses base::DataPack. | 211 // Everyone else uses base::DataPack. |
212 typedef DataPack* DataHandle; | 212 typedef DataPack* DataHandle; |
213 #endif | 213 #endif |
214 | 214 |
215 // Ctor/dtor are private, since we're a singleton. | 215 // Ctor/dtor are private, since we're a singleton. |
216 ResourceBundle(); | 216 ResourceBundle(); |
217 ~ResourceBundle(); | 217 ~ResourceBundle(); |
218 | 218 |
219 // Free skia_images_. | 219 // Free skia_images_. |
220 void FreeImages(); | 220 void FreeImages(); |
221 | 221 |
222 // Load the main resources. | 222 // Load the main resources. |
223 void LoadCommonResources(); | 223 void LoadCommonResources(); |
224 | 224 |
225 // Try to load the locale specific strings from an external data module. | 225 // Try to load the locale specific strings from an external data module. |
226 // Returns the locale that is loaded. | 226 // Returns the locale that is loaded. |
227 std::string LoadLocaleResources(const std::string& pref_locale); | 227 std::string LoadLocaleResources(const std::string& pref_locale); |
228 | 228 |
229 // Load test resources in given path. | 229 // Load test resources in given path. |
230 void LoadTestResources(const FilePath& path); | 230 void LoadTestResources(const FilePath& path); |
231 | 231 |
232 // Unload the locale specific strings and prepares to load new ones. See | 232 // Unload the locale specific strings and prepares to load new ones. See |
233 // comments for ReloadSharedInstance(). | 233 // comments for ReloadSharedInstance(). |
234 void UnloadLocaleResources(); | 234 void UnloadLocaleResources(); |
235 | 235 |
236 // Initialize all the gfx::Font members if they haven't yet been initialized. | 236 // Initialize all the gfx::Font members if they haven't yet been initialized. |
237 void LoadFontsIfNecessary(); | 237 void LoadFontsIfNecessary(); |
238 | 238 |
239 #if defined(USE_BASE_DATA_PACK) | 239 #if defined(OS_POSIX) |
240 // Returns the full pathname of the main resources file to load. May return | 240 // Returns the full pathname of the main resources file to load. May return |
241 // an empty string if no main resources data files are found. | 241 // an empty string if no main resources data files are found. |
242 static FilePath GetResourcesFilePath(); | 242 static FilePath GetResourcesFilePath(); |
243 | 243 |
244 static FilePath GetLargeIconResourcesFilePath(); | 244 static FilePath GetLargeIconResourcesFilePath(); |
245 #endif | 245 #endif |
246 | 246 |
247 // Returns the full pathname of the locale file to load. May return an empty | 247 // Returns the full pathname of the locale file to load. May return an empty |
248 // string if no locale data files are found. | 248 // string if no locale data files are found. |
249 static FilePath GetLocaleFilePath(const std::string& app_locale); | 249 static FilePath GetLocaleFilePath(const std::string& app_locale); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 296 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
297 }; | 297 }; |
298 | 298 |
299 } // namespace ui | 299 } // namespace ui |
300 | 300 |
301 // TODO(beng): Someday, maybe, get rid of this. | 301 // TODO(beng): Someday, maybe, get rid of this. |
302 using ui::ResourceBundle; | 302 using ui::ResourceBundle; |
303 | 303 |
304 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 304 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |