summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 22:43:02 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 22:43:02 +0000
commitb7125fd56addf151194b09314c1f7f2c9d03a5b9 (patch)
treeca6a7f9d67fcc1dfda7feac741fe632843e563f7 /chrome/common
parent7aea7093469f7c88b7a58bbe7c475b225802c852 (diff)
downloadchromium_src-b7125fd56addf151194b09314c1f7f2c9d03a5b9.zip
chromium_src-b7125fd56addf151194b09314c1f7f2c9d03a5b9.tar.gz
chromium_src-b7125fd56addf151194b09314c1f7f2c9d03a5b9.tar.bz2
Hook up theme images and chrome resource data on linux.
Go ahead and convert our toolbar buttons to using the theme data pack file. Review URL: http://codereview.chromium.org/20433 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9911 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/resource_bundle.cc8
-rw-r--r--chrome/common/resource_bundle_linux.cc23
2 files changed, 18 insertions, 13 deletions
diff --git a/chrome/common/resource_bundle.cc b/chrome/common/resource_bundle.cc
index 69318fd..785dd29 100644
--- a/chrome/common/resource_bundle.cc
+++ b/chrome/common/resource_bundle.cc
@@ -85,7 +85,6 @@ bool ResourceBundle::LoadDataResourceBytes(int resource_id,
}
SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) {
-#if defined(OS_WIN)
// Check to see if we already have the Skia image in the cache.
{
AutoLock lock_scope(lock_);
@@ -115,17 +114,10 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) {
return bitmap.release();
}
-#else
- NOTIMPLEMENTED() << "image resource loading disabled; need data files";
-#endif
// We failed to retrieve the bitmap, show a debugging red square.
{
LOG(WARNING) << "Unable to load bitmap with id " << resource_id;
-#if defined(OS_WIN)
NOTREACHED(); // Want to assert in debug mode.
-#else
- // TODO(port): remove this exception
-#endif
AutoLock lock_scope(lock_); // Guard empty_bitmap initialization.
diff --git a/chrome/common/resource_bundle_linux.cc b/chrome/common/resource_bundle_linux.cc
index 1696402..1cb8307 100644
--- a/chrome/common/resource_bundle_linux.cc
+++ b/chrome/common/resource_bundle_linux.cc
@@ -4,7 +4,9 @@
#include "chrome/common/resource_bundle.h"
+#include "base/base_paths.h"
#include "base/data_pack.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -26,9 +28,16 @@ ResourceBundle::~ResourceBundle() {
}
void ResourceBundle::LoadResources(const std::wstring& pref_locale) {
- // TODO(tc): Load the .pak files to locale_resources_data_ and
- // resources_data_.
- NOTIMPLEMENTED();
+ FilePath resources_data_path;
+ PathService::Get(base::DIR_EXE, &resources_data_path);
+ resources_data_path = resources_data_path.Append(
+ FILE_PATH_LITERAL("chrome.pak"));
+ DCHECK(resources_data_ == NULL) << "resource data already loaded!";
+ resources_data_ = new base::DataPack;
+ bool success = resources_data_->Load(resources_data_path);
+ DCHECK(success) << "failed to load chrome.pak";
+
+ // TODO(tc): Load the .pak file for locale_resources_data_.
}
FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) {
@@ -43,8 +52,12 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) {
}
void ResourceBundle::LoadThemeResources() {
- // TODO(tc): Load the theme .pak file.
- NOTIMPLEMENTED();
+ FilePath theme_data_path;
+ PathService::Get(chrome::DIR_THEMES, &theme_data_path);
+ theme_data_path = theme_data_path.Append(FILE_PATH_LITERAL("default.pak"));
+ theme_data_ = new base::DataPack;
+ bool success = theme_data_->Load(theme_data_path);
+ DCHECK(success) << "failed to load theme data";
}
/* static */