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

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

Issue 1955773002: Enable MD by default on Windows for Canary/Dev and local builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DISALLOW_IMPLICIT_CONSTRUCTORS Created 4 years, 7 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') | ui/base/test/material_design_controller_test_api.h » ('j') | 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 0f95c9e2e08dfdbeaa388cf67755dbdbc57ca9a6..1dc1acded0b0e37488b6750dd6268c45bb7691c2 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,29 @@ SkBitmap CreateEmptyBitmap() {
} // namespace
+
+// ResourceBundle::TemporaryLoader --------------------------------------------
+
+ResourceBundle::TemporaryLoader::TemporaryLoader()
+ : already_loaded_(ResourceBundle::HasSharedInstance()) {
+ if (!already_loaded_) {
+ std::string locale = l10n_util::GetApplicationLocale(std::string());
+ const char kUserDataDirDialogFallbackLocale[] = "en-US";
+ if (locale.empty())
+ locale = kUserDataDirDialogFallbackLocale;
+ ui::ResourceBundle::InitSharedInstanceWithLocale(
+ locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
+ }
+}
+
+ResourceBundle::TemporaryLoader::~TemporaryLoader() {
+ if (!already_loaded_)
+ 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 +196,9 @@ class ResourceBundle::ResourceBundleImageSource : public gfx::ImageSkiaSource {
DISALLOW_COPY_AND_ASSIGN(ResourceBundleImageSource);
};
+
+// ResourceBundle -------------------------------------------------------------
+
// static
std::string ResourceBundle::InitSharedInstanceWithLocale(
const std::string& pref_locale,
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/test/material_design_controller_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698