summaryrefslogtreecommitdiffstats
path: root/chrome/common/resource_bundle_win.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 19:00:50 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 19:00:50 +0000
commit2aad8bb784ec3ba75ee17ec7923a6ab1af235574 (patch)
tree20ddc725fc42d7fefca6f13366184a76d2394a79 /chrome/common/resource_bundle_win.cc
parent105cf0d4d03f6e2da389e9a2c4cb5129a1ff8cda (diff)
downloadchromium_src-2aad8bb784ec3ba75ee17ec7923a6ab1af235574.zip
chromium_src-2aad8bb784ec3ba75ee17ec7923a6ab1af235574.tar.gz
chromium_src-2aad8bb784ec3ba75ee17ec7923a6ab1af235574.tar.bz2
Add a linux stub implementation for resource_bundle.
This should work except for the Load calls that should load .pak files. We don't generate .pak files yet so I left that code blank for now. Mac doesn't compile this yet and is still figuring out how they want to handle resources. Review URL: http://codereview.chromium.org/21020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9151 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/resource_bundle_win.cc')
-rw-r--r--chrome/common/resource_bundle_win.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/chrome/common/resource_bundle_win.cc b/chrome/common/resource_bundle_win.cc
index cebd780..377ba4e 100644
--- a/chrome/common/resource_bundle_win.cc
+++ b/chrome/common/resource_bundle_win.cc
@@ -42,7 +42,10 @@ ResourceBundle::~ResourceBundle() {
}
}
-void ResourceBundle::LoadLocaleResources(const std::wstring& pref_locale) {
+void ResourceBundle::LoadResources(const std::wstring& pref_locale) {
+ // As a convenience, set resources_data_ to the current module.
+ resources_data_ = _AtlBaseModule.GetModuleInstance();
+
DCHECK(NULL == locale_resources_data_) << "locale dll already loaded";
const FilePath& locale_path = GetLocaleFilePath(pref_locale);
if (locale_path.value().empty()) {
@@ -64,7 +67,7 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) {
const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale);
if (app_locale.empty())
- return FilePath(app_locale);
+ return FilePath();
return locale_path.Append(app_locale + L".dll");
}
@@ -81,17 +84,6 @@ void ResourceBundle::LoadThemeResources() {
DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path;
}
-bool ResourceBundle::LoadImageResourceBytes(int resource_id,
- std::vector<unsigned char>* bytes) {
- return LoadResourceBytes(theme_data_, resource_id, bytes);
-}
-
-bool ResourceBundle::LoadDataResourceBytes(int resource_id,
- std::vector<unsigned char>* bytes) {
- return LoadResourceBytes(_AtlBaseModule.GetModuleInstance(),
- resource_id, bytes);
-}
-
/* static */
bool ResourceBundle::LoadResourceBytes(
DataHandle module,
@@ -113,10 +105,6 @@ HICON ResourceBundle::LoadThemeIcon(int icon_id) {
return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id));
}
-std::string ResourceBundle::GetDataResource(int resource_id) {
- return GetRawDataResource(resource_id).as_string();
-}
-
StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
void* data_ptr;
size_t data_size;
@@ -149,8 +137,10 @@ HCURSOR ResourceBundle::LoadCursor(int cursor_id) {
std::wstring ResourceBundle::GetLocalizedString(int message_id) {
// If for some reason we were unable to load a resource dll, return an empty
// string (better than crashing).
- if (!locale_resources_data_)
+ if (!locale_resources_data_) {
+ LOG(WARNING) << "locale resources are not loaded";
return std::wstring();
+ }
DCHECK(IS_INTRESOURCE(message_id));