| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // comments for ReloadSharedInstance(). | 225 // comments for ReloadSharedInstance(). |
| 226 void UnloadLocaleResources(); | 226 void UnloadLocaleResources(); |
| 227 | 227 |
| 228 // Initialize all the gfx::Font members if they haven't yet been initialized. | 228 // Initialize all the gfx::Font members if they haven't yet been initialized. |
| 229 void LoadFontsIfNecessary(); | 229 void LoadFontsIfNecessary(); |
| 230 | 230 |
| 231 #if defined(USE_BASE_DATA_PACK) | 231 #if defined(USE_BASE_DATA_PACK) |
| 232 // Returns the full pathname of the main resources file to load. May return | 232 // Returns the full pathname of the main resources file to load. May return |
| 233 // an empty string if no main resources data files are found. | 233 // an empty string if no main resources data files are found. |
| 234 static FilePath GetResourcesFilePath(); | 234 static FilePath GetResourcesFilePath(); |
| 235 |
| 236 static FilePath GetLargeIconResourcesFilePath(); |
| 235 #endif | 237 #endif |
| 236 | 238 |
| 237 // Returns the full pathname of the locale file to load. May return an empty | 239 // Returns the full pathname of the locale file to load. May return an empty |
| 238 // string if no locale data files are found. | 240 // string if no locale data files are found. |
| 239 static FilePath GetLocaleFilePath(const std::string& app_locale); | 241 static FilePath GetLocaleFilePath(const std::string& app_locale); |
| 240 | 242 |
| 241 // Returns a handle to bytes from the resource |module|, without doing any | 243 // Returns a handle to bytes from the resource |module|, without doing any |
| 242 // processing or interpretation of the resource. Returns whether we | 244 // processing or interpretation of the resource. Returns whether we |
| 243 // successfully read the resource. Caller does not own the data returned | 245 // successfully read the resource. Caller does not own the data returned |
| 244 // through this method and must not modify the data pointed to by |bytes|. | 246 // through this method and must not modify the data pointed to by |bytes|. |
| 245 static RefCountedStaticMemory* LoadResourceBytes(DataHandle module, | 247 static RefCountedStaticMemory* LoadResourceBytes(DataHandle module, |
| 246 int resource_id); | 248 int resource_id); |
| 247 | 249 |
| 248 // Creates and returns a new SkBitmap given the data file to look in and the | 250 // Creates and returns a new SkBitmap given the data file to look in and the |
| 249 // resource id. It's up to the caller to free the returned bitmap when | 251 // resource id. It's up to the caller to free the returned bitmap when |
| 250 // done. | 252 // done. |
| 251 static SkBitmap* LoadBitmap(DataHandle dll_inst, int resource_id); | 253 static SkBitmap* LoadBitmap(DataHandle dll_inst, int resource_id); |
| 252 | 254 |
| 253 // Returns an empty image for when a resource cannot be loaded. This is a | 255 // Returns an empty image for when a resource cannot be loaded. This is a |
| 254 // bright red bitmap. | 256 // bright red bitmap. |
| 255 gfx::Image* GetEmptyImage(); | 257 gfx::Image* GetEmptyImage(); |
| 256 | 258 |
| 257 // Class level lock. Used to protect internal data structures that may be | 259 // Class level lock. Used to protect internal data structures that may be |
| 258 // accessed from other threads (e.g., images_). | 260 // accessed from other threads (e.g., images_). |
| 259 scoped_ptr<base::Lock> lock_; | 261 scoped_ptr<base::Lock> lock_; |
| 260 | 262 |
| 261 // Handles for data sources. | 263 // Handles for data sources. |
| 262 DataHandle resources_data_; | 264 DataHandle resources_data_; |
| 265 DataHandle large_icon_resources_data_; |
| 263 DataHandle locale_resources_data_; | 266 DataHandle locale_resources_data_; |
| 264 | 267 |
| 265 // References to extra data packs loaded via AddDataPackToSharedInstance. | 268 // References to extra data packs loaded via AddDataPackToSharedInstance. |
| 266 std::vector<LoadedDataPack*> data_packs_; | 269 std::vector<LoadedDataPack*> data_packs_; |
| 267 | 270 |
| 268 // Cached images. The ResourceBundle caches all retrieved images and keeps | 271 // Cached images. The ResourceBundle caches all retrieved images and keeps |
| 269 // ownership of the pointers. | 272 // ownership of the pointers. |
| 270 typedef std::map<int, gfx::Image*> ImageMap; | 273 typedef std::map<int, gfx::Image*> ImageMap; |
| 271 ImageMap images_; | 274 ImageMap images_; |
| 272 | 275 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 283 | 286 |
| 284 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 287 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
| 285 }; | 288 }; |
| 286 | 289 |
| 287 } // namespace ui | 290 } // namespace ui |
| 288 | 291 |
| 289 // TODO(beng): Someday, maybe, get rid of this. | 292 // TODO(beng): Someday, maybe, get rid of this. |
| 290 using ui::ResourceBundle; | 293 using ui::ResourceBundle; |
| 291 | 294 |
| 292 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 295 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
| OLD | NEW |