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

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

Issue 1474873002: Android: Don't try to access the native Screen instance when loading resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_wthandroid
Patch Set: Trying to get rid of the dependency... Created 5 years 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 | « no previous file | 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 6d0427158e6f199bbd568e5189010b9a7e11a361..784f6e8655e4d462ea36a157f0cba0e0d09922ba 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -39,6 +39,7 @@
#if defined(OS_ANDROID)
#include "ui/base/resource/resource_bundle_android.h"
+#include "ui/gfx/android/device_display_info.h"
#endif
#if defined(OS_CHROMEOS)
@@ -608,9 +609,13 @@ void ResourceBundle::InitSharedInstance(Delegate* delegate) {
supported_scale_factors.push_back(SCALE_FACTOR_100P);
#endif
#if defined(OS_ANDROID)
- const gfx::Display display =
- gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
- const float display_density = display.device_scale_factor();
+ float display_density;
+ if (gfx::Display::HasForceDeviceScaleFactor()) {
+ display_density = gfx::Display::GetForcedDeviceScaleFactor();
+ } else {
+ gfx::DeviceDisplayInfo device_info;
+ display_density = device_info.GetDIPScale();
+ }
const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density);
if (closest != SCALE_FACTOR_100P)
supported_scale_factors.push_back(closest);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698