Chromium Code Reviews| Index: ui/base/resource/resource_bundle.cc |
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc |
| index 0f95c9e2e08dfdbeaa388cf67755dbdbc57ca9a6..b59694d6c5648843e84523d66d102dad09d089c5 100644 |
| --- a/ui/base/resource/resource_bundle.cc |
| +++ b/ui/base/resource/resource_bundle.cc |
| @@ -57,6 +57,8 @@ |
| #include "ui/display/win/dpi.h" |
| #endif |
| +// Helpers -------------------------------------------------------------------- |
| + |
| namespace ui { |
| namespace { |
| @@ -114,6 +116,26 @@ SkBitmap CreateEmptyBitmap() { |
| } // namespace |
| + |
| +// ResourceBundle::TemporaryLoader -------------------------------------------- |
| + |
| +ResourceBundle::TemporaryLoader::TemporaryLoader() { |
| + DCHECK(!ResourceBundle::HasSharedInstance()); |
| + std::string locale = l10n_util::GetApplicationLocale(std::string()); |
| + const char kUserDataDirDialogFallbackLocale[] = "en-US"; |
| + if (locale.empty()) |
| + locale = kUserDataDirDialogFallbackLocale; |
| + ui::ResourceBundle::InitSharedInstanceWithLocale( |
| + locale, NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); |
|
sky
2016/05/13 15:49:56
nullptr
Peter Kasting
2016/05/16 19:53:16
Done.
|
| +} |
| + |
| +ResourceBundle::TemporaryLoader::~TemporaryLoader() { |
| + ResourceBundle::CleanupSharedInstance(); |
| +} |
| + |
| + |
| +// ResourceBundle::ResourceBundleImageSource ---------------------------------- |
| + |
| // An ImageSkiaSource that loads bitmaps for the requested scale factor from |
| // ResourceBundle on demand for a given |resource_id|. If the bitmap for the |
| // requested scale factor does not exist, it will return the 1x bitmap scaled |
| @@ -171,6 +193,9 @@ class ResourceBundle::ResourceBundleImageSource : public gfx::ImageSkiaSource { |
| DISALLOW_COPY_AND_ASSIGN(ResourceBundleImageSource); |
| }; |
| + |
| +// ResourceBundle ------------------------------------------------------------- |
| + |
| // static |
| std::string ResourceBundle::InitSharedInstanceWithLocale( |
| const std::string& pref_locale, |