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

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

Issue 2311223003: [chromecast] Add ResourceBundle::LoadLocalizedResourceBytes(). (Closed)
Patch Set: [chromecast] Add ResourceBundle::LoadLocalizedResourceBytes() to to get binary data from locale_res… Created 4 years, 3 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
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle.cc
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index 049c5e26962a1c0c197877cc048b3f7e0d0e0104..899a8a45cb95aaf05737504cde5e9780fdf25afd 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -556,6 +556,22 @@ base::string16 ResourceBundle::GetLocalizedString(int message_id) {
return msg;
}
+base::RefCountedMemory* ResourceBundle::LoadLocalizedResourceBytes(
+ int resource_id) {
+ {
+ base::AutoLock lock_scope(*locale_resources_data_lock_);
+ base::StringPiece data;
+ if (locale_resources_data_.get() &&
+ locale_resources_data_->GetStringPiece(
+ static_cast<uint16_t>(resource_id), &data) &&
+ !data.empty()) {
+ return new base::RefCountedStaticMemory(data.data(), data.length());
+ }
+ }
+ // Release lock_scope and fall back to main data pack.
+ return LoadDataResourceBytes(resource_id);
+}
+
const gfx::FontList& ResourceBundle::GetFontListWithDelta(
int size_delta,
gfx::Font::FontStyle style,
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698