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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetImageNamed); | 259 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetImageNamed); |
260 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetNativeImageNamed); | 260 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetNativeImageNamed); |
261 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateLoadDataResourceBytes); | 261 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateLoadDataResourceBytes); |
262 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetRawDataResource); | 262 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetRawDataResource); |
263 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetLocalizedString); | 263 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetLocalizedString); |
264 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetFont); | 264 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetFont); |
265 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, GetRawDataResource); | 265 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, GetRawDataResource); |
266 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, LoadDataResourceBytes); | 266 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, LoadDataResourceBytes); |
267 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, LocaleDataPakExists); | 267 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, LocaleDataPakExists); |
268 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, GetImageNamed); | 268 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, GetImageNamed); |
269 FRIEND_TEST_ALL_PREFIXES(ResourceBundle, FallbackToNone); | |
pkotwicz
2012/11/07 06:40:44
Nit: When you rebase, you will probably find this
oshima
2012/11/07 22:35:30
Done.
| |
269 | 270 |
270 class ResourceBundleImageSource; | 271 class ResourceBundleImageSource; |
271 friend class ResourceBundleImageSource; | 272 friend class ResourceBundleImageSource; |
272 | 273 |
273 // Ctor/dtor are private, since we're a singleton. | 274 // Ctor/dtor are private, since we're a singleton. |
274 explicit ResourceBundle(Delegate* delegate); | 275 explicit ResourceBundle(Delegate* delegate); |
275 ~ResourceBundle(); | 276 ~ResourceBundle(); |
276 | 277 |
277 // Free skia_images_. | 278 // Free skia_images_. |
278 void FreeImages(); | 279 void FreeImages(); |
(...skipping 30 matching lines...) Expand all Loading... | |
309 // Returns false if the resource does not exist. | 310 // Returns false if the resource does not exist. |
310 // | 311 // |
311 // If the call succeeds, |fell_back_to_1x| indicates whether Chrome's custom | 312 // If the call succeeds, |fell_back_to_1x| indicates whether Chrome's custom |
312 // csCl PNG chunk is present (added by GRIT if it falls back to a 100% image). | 313 // csCl PNG chunk is present (added by GRIT if it falls back to a 100% image). |
313 bool LoadBitmap(const ResourceHandle& data_handle, | 314 bool LoadBitmap(const ResourceHandle& data_handle, |
314 int resource_id, | 315 int resource_id, |
315 SkBitmap* bitmap, | 316 SkBitmap* bitmap, |
316 bool* fell_back_to_1x) const; | 317 bool* fell_back_to_1x) const; |
317 | 318 |
318 // Fills the |bitmap| given the |resource_id| and |scale_factor|. | 319 // Fills the |bitmap| given the |resource_id| and |scale_factor|. |
319 // Returns false if the resource does not exist. | 320 // Returns false if the resource does not exist. This may fall back to |
321 // the data pack with SCALE_FACTOR_NONE, and when this happens, | |
322 // |scale_factor| will be set to SCALE_FACTOR_100P. | |
320 bool LoadBitmap(int resource_id, | 323 bool LoadBitmap(int resource_id, |
321 ScaleFactor scale_factor, | 324 ScaleFactor* scale_factor, |
322 SkBitmap* bitmap, | 325 SkBitmap* bitmap, |
323 bool* fell_back_to_1x) const; | 326 bool* fell_back_to_1x) const; |
324 | 327 |
325 // Returns an empty image for when a resource cannot be loaded. This is a | 328 // Returns an empty image for when a resource cannot be loaded. This is a |
326 // bright red bitmap. | 329 // bright red bitmap. |
327 gfx::Image& GetEmptyImage(); | 330 gfx::Image& GetEmptyImage(); |
328 | 331 |
329 const FilePath& GetOverriddenPakPath(); | 332 const FilePath& GetOverriddenPakPath(); |
330 | 333 |
331 // This pointer is guaranteed to outlive the ResourceBundle instance and may | 334 // This pointer is guaranteed to outlive the ResourceBundle instance and may |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 | 369 |
367 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 370 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
368 }; | 371 }; |
369 | 372 |
370 } // namespace ui | 373 } // namespace ui |
371 | 374 |
372 // TODO(beng): Someday, maybe, get rid of this. | 375 // TODO(beng): Someday, maybe, get rid of this. |
373 using ui::ResourceBundle; | 376 using ui::ResourceBundle; |
374 | 377 |
375 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 378 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |