| Index: ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
|
| diff --git a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
|
| index 9897728a1ff34d33bb0876a338313a28c3a2e717..94dbc95f9305df1ff6b4c04830cd6de59b34b1a8 100644
|
| --- a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
|
| +++ b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
|
| @@ -12,6 +12,8 @@ import android.util.SparseArray;
|
|
|
| import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.base.annotations.JNINamespace;
|
| +import org.chromium.ui.base.WindowAndroid;
|
| +import org.chromium.ui.gfx.DeviceDisplayInfo;
|
| import org.chromium.ui.resources.ResourceLoader.ResourceLoaderCallback;
|
| import org.chromium.ui.resources.dynamics.DynamicResource;
|
| import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
|
| @@ -35,33 +37,44 @@ public class ResourceManager implements ResourceLoaderCallback {
|
|
|
| private long mNativeResourceManagerPtr;
|
|
|
| - private ResourceManager(Context context, long staticResourceManagerPtr) {
|
| + private ResourceManager(WindowAndroid windowAndroid, long staticResourceManagerPtr) {
|
| + Context context = windowAndroid.getContext().get();
|
| Resources resources = context.getResources();
|
| mPxToDp = 1.f / resources.getDisplayMetrics().density;
|
|
|
| - // Register ResourceLoaders
|
| + DeviceDisplayInfo displayInfo = DeviceDisplayInfo.create(context);
|
| + int screenWidth = displayInfo.getPhysicalDisplayWidth() != 0
|
| + ? displayInfo.getPhysicalDisplayWidth()
|
| + : displayInfo.getDisplayWidth();
|
| + int screenHeight = displayInfo.getPhysicalDisplayHeight() != 0
|
| + ? displayInfo.getPhysicalDisplayHeight()
|
| + : displayInfo.getDisplayHeight();
|
| + int minScreenSideLength = Math.min(screenWidth, screenHeight);
|
| +
|
| registerResourceLoader(new StaticResourceLoader(
|
| AndroidResourceType.STATIC, this, resources));
|
| registerResourceLoader(new DynamicResourceLoader(
|
| AndroidResourceType.DYNAMIC, this));
|
| registerResourceLoader(new DynamicResourceLoader(
|
| AndroidResourceType.DYNAMIC_BITMAP, this));
|
| - registerResourceLoader(new SystemResourceLoader(
|
| - AndroidResourceType.SYSTEM, this, context));
|
| + registerResourceLoader(
|
| + new SystemResourceLoader(AndroidResourceType.SYSTEM, this, minScreenSideLength));
|
| mCrushedSpriteResourceLoader = new CrushedSpriteResourceLoader(this, resources);
|
|
|
| mNativeResourceManagerPtr = staticResourceManagerPtr;
|
| }
|
|
|
| /**
|
| - * Creates an instance of a {@link ResourceManager}. This will
|
| - * @param context A {@link Context} instance to grab {@link Resources} from.
|
| + * Creates an instance of a {@link ResourceManager}.
|
| + * @param WindowAndroid A {@link Window} instance to fetch a {@link Context} and thus
|
| + * grab {@link Resources} from.
|
| * @param staticResourceManagerPtr A pointer to the native component of this class.
|
| * @return A new instance of a {@link ResourceManager}.
|
| */
|
| @CalledByNative
|
| - private static ResourceManager create(Context context, long staticResourceManagerPtr) {
|
| - return new ResourceManager(context, staticResourceManagerPtr);
|
| + private static ResourceManager create(
|
| + WindowAndroid windowAndroid, long staticResourceManagerPtr) {
|
| + return new ResourceManager(windowAndroid, staticResourceManagerPtr);
|
| }
|
|
|
| /**
|
|
|