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

Unified Diff: ui/base/resource/data_pack.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. 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/data_pack.cc
diff --git a/ui/base/resource/data_pack.cc b/ui/base/resource/data_pack.cc
index 0fa97a83bd03104425edc2ae2d96b2647cabc2f7..e1d8c144ac54ec21c7f3448c3f9b34a6b713d659 100644
--- a/ui/base/resource/data_pack.cc
+++ b/ui/base/resource/data_pack.cc
@@ -61,7 +61,7 @@ enum LoadErrors {
namespace ui {
-DataPack::DataPack(float scale_factor)
+DataPack::DataPack(ui::ScaleFactor scale_factor)
: resource_count_(0),
text_encoding_type_(BINARY),
scale_factor_(scale_factor) {
@@ -145,6 +145,11 @@ bool DataPack::Load(const FilePath& path) {
return true;
}
+bool DataPack::HasResource(uint16 resource_id) const {
+ return !!bsearch(&resource_id, mmap_->data() + kHeaderLength, resource_count_,
+ sizeof(DataPackEntry), DataPackEntry::CompareById);
+}
+
bool DataPack::GetStringPiece(uint16 resource_id,
base::StringPiece* data) const {
// It won't be hard to make this endian-agnostic, but it's not worth
@@ -186,7 +191,7 @@ ResourceHandle::TextEncodingType DataPack::GetTextEncodingType() const {
return text_encoding_type_;
}
-float DataPack::GetScaleFactor() const {
+ui::ScaleFactor DataPack::GetScaleFactor() const {
return scale_factor_;
}

Powered by Google App Engine
This is Rietveld 408576698