Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: ui/base/resource/resource_bundle.h

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert ptr to bool for win compile. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/resource/resource_bundle.h
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h
index df25f31d31a36eb87a09f2122c92a23f79905ca7..708f78a272f7a2a2ae14270f973e97175939af99 100644
--- a/ui/base/resource/resource_bundle.h
+++ b/ui/base/resource/resource_bundle.h
@@ -89,11 +89,13 @@ class UI_EXPORT ResourceBundle {
// Return a static memory resource or NULL to attempt retrieval of the
// default resource.
virtual base::RefCountedStaticMemory* LoadDataResourceBytes(
- int resource_id) = 0;
+ int resource_id,
+ float scale_factor) = 0;
// Retrieve a raw data resource. Return true if a resource was provided or
// false to attempt retrieval of the default resource.
virtual bool GetRawDataResource(int resource_id,
+ float scale_factor,
base::StringPiece* value) = 0;
// Retrieve a localized string. Return true if a string was provided or
@@ -181,13 +183,18 @@ class UI_EXPORT ResourceBundle {
// Same as GetNativeImageNamed() except that RTL is not enabled.
gfx::Image& GetNativeImageNamed(int resource_id);
- // Loads the raw bytes of a data resource into |bytes|,
- // without doing any processing or interpretation of
- // the resource. Returns whether we successfully read the resource.
- base::RefCountedStaticMemory* LoadDataResourceBytes(int resource_id) const;
+ // Loads the raw bytes of a data resource nearest the scale factor
+ // |scale_factor| into |bytes|, without doing any processing or interpretation
+ // of the resource. Use ResourceHandle::kScaleFactorNone for non-image
+ // resources. Returns NULL if we fail to read the resource.
+ base::RefCountedStaticMemory* LoadDataResourceBytes(int resource_id,
+ float scale_factor) const;
- // Return the contents of a resource in a StringPiece given the resource id.
- base::StringPiece GetRawDataResource(int resource_id) const;
+ // Return the contents of a resource in a StringPiece given the resource id
+ // nearest the scale factor |scale_factor|.
+ // Use ResourceHanlde::kScaleFactorNone for non-image resources.
+ base::StringPiece GetRawDataResource(int resource_id,
+ float scale_factor) const;
// Get a localized string given a message id. Returns an empty
// string if the message_id is not found.
@@ -213,6 +220,7 @@ class UI_EXPORT ResourceBundle {
FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetRawDataResource);
FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetLocalizedString);
FRIEND_TEST_ALL_PREFIXES(ResourceBundle, DelegateGetFont);
+ FRIEND_TEST_ALL_PREFIXES(ResourceBundle, GetRawDataResource);
FRIEND_TEST_ALL_PREFIXES(ResourceBundle, LoadDataResourceBytes);
FRIEND_TEST_ALL_PREFIXES(ResourceBundle, LocaleDataPakExists);
@@ -230,8 +238,9 @@ class UI_EXPORT ResourceBundle {
// Returns the locale that is loaded.
std::string LoadLocaleResources(const std::string& pref_locale);
- // Load test resources in given path.
- void LoadTestResources(const FilePath& path);
+ // Load test resources in given paths. If either path is empty an empty
+ // resource pack is loaded.
+ void LoadTestResources(const FilePath& path, const FilePath& locale_path);
// Unload the locale specific strings and prepares to load new ones. See
// comments for ReloadLocaleResources().

Powered by Google App Engine
This is Rietveld 408576698