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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // resource pack is loaded. | 268 // resource pack is loaded. |
269 void LoadTestResources(const FilePath& path, const FilePath& locale_path); | 269 void LoadTestResources(const FilePath& path, const FilePath& locale_path); |
270 | 270 |
271 // Unload the locale specific strings and prepares to load new ones. See | 271 // Unload the locale specific strings and prepares to load new ones. See |
272 // comments for ReloadLocaleResources(). | 272 // comments for ReloadLocaleResources(). |
273 void UnloadLocaleResources(); | 273 void UnloadLocaleResources(); |
274 | 274 |
275 // Initialize all the gfx::Font members if they haven't yet been initialized. | 275 // Initialize all the gfx::Font members if they haven't yet been initialized. |
276 void LoadFontsIfNecessary(); | 276 void LoadFontsIfNecessary(); |
277 | 277 |
278 // Creates and returns a new SkBitmap given the data file to look in and the | 278 // Fills the |bitmap| given the data file to look in and the |resource_id|. |
279 // |resource_id|. It's up to the caller to free the returned bitmap when | 279 // Returns false if the resource does not exist. |
280 // done. | 280 // |
281 SkBitmap* LoadBitmap(const ResourceHandle& dll_inst, int resource_id) const; | 281 // If the call succeeds and |fell_back_to_1x| is not NULL, it is set to true |
| 282 // if Chrome's custom csCl PNG chunk is present (indicating that GRIT fell |
| 283 // back to the 100% image), false if not. |
| 284 bool LoadBitmap(const ResourceHandle& data_handle, |
| 285 int resource_id, |
| 286 SkBitmap* bitmap, |
| 287 bool* fell_back_to_1x) const; |
282 | 288 |
283 // Creates and returns a new SkBitmap for |resource_id| and |scale_factor|. | 289 // Fills the |bitmap| given the |resource_id| and |scale_factor|. |
284 // Returns NULL if the resource does not exist. | 290 // Returns false if the resource does not exist. |
285 SkBitmap* LoadBitmap(int resource_id, ScaleFactor scale_factor) const; | 291 bool LoadBitmap(int resource_id, |
| 292 ScaleFactor scale_factor, |
| 293 SkBitmap* bitmap, |
| 294 bool* fell_back_to_1x) const; |
286 | 295 |
287 // Returns an empty image for when a resource cannot be loaded. This is a | 296 // Returns an empty image for when a resource cannot be loaded. This is a |
288 // bright red bitmap. | 297 // bright red bitmap. |
289 gfx::Image& GetEmptyImage(); | 298 gfx::Image& GetEmptyImage(); |
290 | 299 |
291 const FilePath& GetOverriddenPakPath(); | 300 const FilePath& GetOverriddenPakPath(); |
292 | 301 |
293 // This pointer is guaranteed to outlive the ResourceBundle instance and may | 302 // This pointer is guaranteed to outlive the ResourceBundle instance and may |
294 // be NULL. | 303 // be NULL. |
295 Delegate* delegate_; | 304 Delegate* delegate_; |
(...skipping 29 matching lines...) Expand all Loading... |
325 | 334 |
326 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 335 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
327 }; | 336 }; |
328 | 337 |
329 } // namespace ui | 338 } // namespace ui |
330 | 339 |
331 // TODO(beng): Someday, maybe, get rid of this. | 340 // TODO(beng): Someday, maybe, get rid of this. |
332 using ui::ResourceBundle; | 341 using ui::ResourceBundle; |
333 | 342 |
334 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 343 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |