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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // Initialize the ResourceBundle for this process. Returns the language | 77 // Initialize the ResourceBundle for this process. Returns the language |
78 // selected. | 78 // selected. |
79 // NOTE: Mac ignores this and always loads up resources for the language | 79 // NOTE: Mac ignores this and always loads up resources for the language |
80 // defined by the Cocoa UI (ie-NSBundle does the langange work). | 80 // defined by the Cocoa UI (ie-NSBundle does the langange work). |
81 static std::string InitSharedInstance(const std::string& pref_locale); | 81 static std::string InitSharedInstance(const std::string& pref_locale); |
82 | 82 |
83 // Initialize the ResourceBundle using given data pack path for testing. | 83 // Initialize the ResourceBundle using given data pack path for testing. |
84 static void InitSharedInstanceForTest(const FilePath& path); | 84 static void InitSharedInstanceForTest(const FilePath& path); |
85 | 85 |
86 // Load a .pak file. Returns NULL if we fail to load |path|. The caller | |
87 // is responsible for deleting up this pointer. | |
88 static DataPack* LoadResourcesDataPak(const FilePath& path); | |
89 | |
90 // Changes the locale for an already-initialized ResourceBundle. Future | 86 // Changes the locale for an already-initialized ResourceBundle. Future |
91 // calls to get strings will return the strings for this new locale. This | 87 // calls to get strings will return the strings for this new locale. This |
92 // has no effect on existing or future image resources. This has no effect | 88 // has no effect on existing or future image resources. This has no effect |
93 // on existing or future image resources, and thus does not use the lock to | 89 // on existing or future image resources, and thus does not use the lock to |
94 // guarantee thread-safety, since all string access is expected to happen on | 90 // guarantee thread-safety, since all string access is expected to happen on |
95 // the UI thread. | 91 // the UI thread. |
96 static std::string ReloadSharedInstance(const std::string& pref_locale); | 92 static std::string ReloadSharedInstance(const std::string& pref_locale); |
97 | 93 |
98 // Registers additional data pack files with the global ResourceBundle. When | 94 // Registers additional data pack files with the global ResourceBundle. When |
99 // looking for a DataResource, we will search these files after searching the | 95 // looking for a DataResource, we will search these files after searching the |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // bright red bitmap. | 264 // bright red bitmap. |
269 gfx::Image* GetEmptyImage(); | 265 gfx::Image* GetEmptyImage(); |
270 | 266 |
271 // Class level lock. Used to protect internal data structures that may be | 267 // Class level lock. Used to protect internal data structures that may be |
272 // accessed from other threads (e.g., images_). | 268 // accessed from other threads (e.g., images_). |
273 scoped_ptr<base::Lock> lock_; | 269 scoped_ptr<base::Lock> lock_; |
274 | 270 |
275 // Handles for data sources. | 271 // Handles for data sources. |
276 DataHandle resources_data_; | 272 DataHandle resources_data_; |
277 DataHandle large_icon_resources_data_; | 273 DataHandle large_icon_resources_data_; |
278 #if !defined(NACL_WIN64) | 274 DataHandle locale_resources_data_; |
279 scoped_ptr<DataPack> locale_resources_data_; | |
280 #endif | |
281 | 275 |
282 // References to extra data packs loaded via AddDataPackToSharedInstance. | 276 // References to extra data packs loaded via AddDataPackToSharedInstance. |
283 std::vector<LoadedDataPack*> data_packs_; | 277 std::vector<LoadedDataPack*> data_packs_; |
284 | 278 |
285 // Cached images. The ResourceBundle caches all retrieved images and keeps | 279 // Cached images. The ResourceBundle caches all retrieved images and keeps |
286 // ownership of the pointers. | 280 // ownership of the pointers. |
287 typedef std::map<int, gfx::Image*> ImageMap; | 281 typedef std::map<int, gfx::Image*> ImageMap; |
288 ImageMap images_; | 282 ImageMap images_; |
289 | 283 |
290 // The various fonts used. Cached to avoid repeated GDI creation/destruction. | 284 // The various fonts used. Cached to avoid repeated GDI creation/destruction. |
(...skipping 10 matching lines...) Expand all Loading... |
301 | 295 |
302 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 296 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
303 }; | 297 }; |
304 | 298 |
305 } // namespace ui | 299 } // namespace ui |
306 | 300 |
307 // TODO(beng): Someday, maybe, get rid of this. | 301 // TODO(beng): Someday, maybe, get rid of this. |
308 using ui::ResourceBundle; | 302 using ui::ResourceBundle; |
309 | 303 |
310 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 304 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |