diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 20:45:08 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 20:45:08 +0000 |
commit | d8fef52b071be812fd8a0f7ebea6c577bdb38592 (patch) | |
tree | 3ad1d267a3d978e4e68c0f3c49c3781e155e1a3f /app | |
parent | 19e0ff7bf0b74a121d52a75b1d883222d266b789 (diff) | |
download | chromium_src-d8fef52b071be812fd8a0f7ebea6c577bdb38592.zip chromium_src-d8fef52b071be812fd8a0f7ebea6c577bdb38592.tar.gz chromium_src-d8fef52b071be812fd8a0f7ebea6c577bdb38592.tar.bz2 |
Modify DataPacks so they can return RefCountedStaticMemory objects.
(This is in preparation for a very large reworking of BrowserThemeProvider).
BUG=http://crbug.com/21121
Review URL: http://codereview.chromium.org/338027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/resource_bundle_linux.cc | 15 | ||||
-rw-r--r-- | app/resource_bundle_mac.mm | 15 |
2 files changed, 8 insertions, 22 deletions
diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc index 5c5cb50..10d5caa 100644 --- a/app/resource_bundle_linux.cc +++ b/app/resource_bundle_linux.cc @@ -121,24 +121,17 @@ void ResourceBundle::LoadThemeResources() { RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { DCHECK(module); - base::StringPiece bytes; - if (!module->Get(resource_id, &bytes)) - return NULL; - - return new RefCountedStaticMemory( - reinterpret_cast<const unsigned char*>(bytes.data()), bytes.length()); + return module->GetStaticMemory(resource_id); } base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { DCHECK(resources_data_); base::StringPiece data; - - if (!resources_data_->Get(resource_id, &data)) { - if (!locale_resources_data_->Get(resource_id, &data)) { + if (!resources_data_->GetStringPiece(resource_id, &data)) { + if (!locale_resources_data_->GetStringPiece(resource_id, &data)) { return base::StringPiece(); } } - return data; } @@ -151,7 +144,7 @@ string16 ResourceBundle::GetLocalizedString(int message_id) { } base::StringPiece data; - if (!locale_resources_data_->Get(message_id, &data)) { + if (!locale_resources_data_->GetStringPiece(message_id, &data)) { // Fall back on the main data pack (shouldn't be any strings here except in // unittests). data = GetRawDataResource(message_id); diff --git a/app/resource_bundle_mac.mm b/app/resource_bundle_mac.mm index 92b9120..0bde757 100644 --- a/app/resource_bundle_mac.mm +++ b/app/resource_bundle_mac.mm @@ -75,24 +75,17 @@ void ResourceBundle::LoadThemeResources() { RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { DCHECK(module); - base::StringPiece bytes; - if (!module->Get(resource_id, &bytes)) - return NULL; - - return new RefCountedStaticMemory( - reinterpret_cast<const unsigned char*>(bytes.data()), bytes.length()); + return module->GetStaticMemory(resource_id); } base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { DCHECK(resources_data_); base::StringPiece data; - - if (!resources_data_->Get(resource_id, &data)) { - if (!locale_resources_data_->Get(resource_id, &data)) { + if (!resources_data_->GetStringPiece(resource_id, &data)) { + if (!locale_resources_data_->GetStringPiece(resource_id, &data)) { return base::StringPiece(); } } - return data; } @@ -105,7 +98,7 @@ string16 ResourceBundle::GetLocalizedString(int message_id) { } base::StringPiece data; - if (!locale_resources_data_->Get(message_id, &data)) { + if (!locale_resources_data_->GetStringPiece(message_id, &data)) { // Fall back on the main data pack (shouldn't be any strings here except in // unittests). data = GetRawDataResource(message_id); |