summaryrefslogtreecommitdiffstats
path: root/app/resource_bundle.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-22 06:45:22 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-22 06:45:22 +0000
commit4f97280e6b2e0f2eab7fb3f504be1d85f5649a76 (patch)
tree165fffb015d0cd17533104017217eac3f78c9564 /app/resource_bundle.cc
parent8c785eba63d0a6a4265d762e0be5daf1b769ff4c (diff)
downloadchromium_src-4f97280e6b2e0f2eab7fb3f504be1d85f5649a76.zip
chromium_src-4f97280e6b2e0f2eab7fb3f504be1d85f5649a76.tar.gz
chromium_src-4f97280e6b2e0f2eab7fb3f504be1d85f5649a76.tar.bz2
Load net-internals resources from resources.pak.
This is the same as r50257 with 2 fixes: 1) Copy resources.pak to <(PRODUCT_DIR) on mac so it will work for things tests. 2) Add back the check in chrome_paths.cc to see if we're in a mac bundle or not. BUG=35793,42770 TEST=none Review URL: http://codereview.chromium.org/2865010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/resource_bundle.cc')
-rw-r--r--app/resource_bundle.cc28
1 files changed, 19 insertions, 9 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc
index dcf7fa8..d61e83d 100644
--- a/app/resource_bundle.cc
+++ b/app/resource_bundle.cc
@@ -105,7 +105,17 @@ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) {
RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes(
int resource_id) const {
- return LoadResourceBytes(resources_data_, resource_id);
+ RefCountedStaticMemory* bytes =
+ LoadResourceBytes(resources_data_, resource_id);
+
+ // Check all our additional data packs for the resources if it wasn't loaded
+ // from our main source.
+ for (std::vector<LoadedDataPack*>::const_iterator it = data_packs_.begin();
+ !bytes && it != data_packs_.end(); ++it) {
+ bytes = (*it)->GetStaticMemory(resource_id);
+ }
+
+ return bytes;
}
SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) {
@@ -198,11 +208,8 @@ const gfx::Font& ResourceBundle::GetFont(FontStyle style) {
// LoadedDataPack implementation
ResourceBundle::LoadedDataPack::LoadedDataPack(const FilePath& path)
: path_(path) {
- // On unicies, we preload data packs so background updates don't cause us to
- // load the wrong data.
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ // Always preload the data packs so we can maintain constness.
Load();
-#endif
}
void ResourceBundle::LoadedDataPack::Load() {
@@ -212,9 +219,12 @@ void ResourceBundle::LoadedDataPack::Load() {
CHECK(success) << "Failed to load " << path_.value();
}
-bool ResourceBundle::LoadedDataPack::GetStringPiece(int resource_id,
- base::StringPiece* data) {
- if (!data_pack_.get())
- Load();
+bool ResourceBundle::LoadedDataPack::GetStringPiece(
+ int resource_id, base::StringPiece* data) const {
return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data);
}
+
+RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory(
+ int resource_id) const {
+ return data_pack_->GetStaticMemory(resource_id);
+}