Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 // resource pack is loaded. | 275 // resource pack is loaded. |
| 276 void LoadTestResources(const FilePath& path, const FilePath& locale_path); | 276 void LoadTestResources(const FilePath& path, const FilePath& locale_path); |
| 277 | 277 |
| 278 // Unload the locale specific strings and prepares to load new ones. See | 278 // Unload the locale specific strings and prepares to load new ones. See |
| 279 // comments for ReloadLocaleResources(). | 279 // comments for ReloadLocaleResources(). |
| 280 void UnloadLocaleResources(); | 280 void UnloadLocaleResources(); |
| 281 | 281 |
| 282 // Initialize all the gfx::Font members if they haven't yet been initialized. | 282 // Initialize all the gfx::Font members if they haven't yet been initialized. |
| 283 void LoadFontsIfNecessary(); | 283 void LoadFontsIfNecessary(); |
| 284 | 284 |
| 285 // Creates and returns a new SkBitmap given the data file to look in and the | 285 // Fills the |bitmap| given the data file to look in and the |resource_id|. |
| 286 // |resource_id|. It's up to the caller to free the returned bitmap when | 286 // Returns false if the resource does not exist. |
| 287 // done. | 287 // |
| 288 SkBitmap* LoadBitmap(const ResourceHandle& dll_inst, int resource_id) const; | 288 // If the call succeeds and |scale_fallback| is not NULL, it is set to true |
| 289 // if Chrome's custom csCl PNG chunk is present (indicating that GRIT fell | |
| 290 // back to the 100% image), false if not. | |
| 291 bool LoadBitmap(const ResourceHandle& data_handle, | |
| 292 int resource_id, | |
| 293 SkBitmap* bitmap, | |
| 294 bool* scale_fallback) const; | |
|
sail
2012/10/09 22:01:37
scale_fallback is not very descriptive. maybe did_
benrg
2012/10/10 02:18:13
How about fell_back_to_1x?
| |
| 289 | 295 |
| 290 // Creates and returns a new SkBitmap for |resource_id| and |scale_factor|. | 296 // Fills the |bitmap| given the |resource_id| and |scale_factor|. |
| 291 // Returns NULL if the resource does not exist. | 297 // Returns false if the resource does not exist. |
| 292 SkBitmap* LoadBitmap(int resource_id, ScaleFactor scale_factor) const; | 298 bool LoadBitmap(int resource_id, |
| 299 ScaleFactor scale_factor, | |
| 300 SkBitmap* bitmap, | |
| 301 bool* scale_fallback) const; | |
| 293 | 302 |
| 294 // Returns an empty image for when a resource cannot be loaded. This is a | 303 // Returns an empty image for when a resource cannot be loaded. This is a |
| 295 // bright red bitmap. | 304 // bright red bitmap. |
| 296 gfx::Image& GetEmptyImage(); | 305 gfx::Image& GetEmptyImage(); |
| 297 | 306 |
| 298 const FilePath& GetOverriddenPakPath(); | 307 const FilePath& GetOverriddenPakPath(); |
| 299 | 308 |
| 300 // This pointer is guaranteed to outlive the ResourceBundle instance and may | 309 // This pointer is guaranteed to outlive the ResourceBundle instance and may |
| 301 // be NULL. | 310 // be NULL. |
| 302 Delegate* delegate_; | 311 Delegate* delegate_; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 332 | 341 |
| 333 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 342 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
| 334 }; | 343 }; |
| 335 | 344 |
| 336 } // namespace ui | 345 } // namespace ui |
| 337 | 346 |
| 338 // TODO(beng): Someday, maybe, get rid of this. | 347 // TODO(beng): Someday, maybe, get rid of this. |
| 339 using ui::ResourceBundle; | 348 using ui::ResourceBundle; |
| 340 | 349 |
| 341 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 350 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
| OLD | NEW |