| Index: ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
|
| diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
|
| index dabb468983aa8e19a23b3e5ce859786048a0485c..0b2d48488b8d377ab564c5fc5de453675de9c0dc 100644
|
| --- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
|
| +++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
|
| @@ -71,6 +71,7 @@ public class WindowAndroid {
|
| // Native pointer to the c++ WindowAndroid object.
|
| private long mNativeWindowAndroid = 0;
|
| private final VSyncMonitor mVSyncMonitor;
|
| + private final DIPScaleMonitor mDIPScaleMonitor;
|
|
|
| // A string used as a key to store intent errors in a bundle
|
| static final String WINDOW_CALLBACK_ERRORS = "window_callback_errors";
|
| @@ -173,6 +174,7 @@ public class WindowAndroid {
|
| mOutstandingIntents = new SparseArray<IntentCallback>();
|
| mIntentErrors = new HashMap<Integer, String>();
|
| mVSyncMonitor = new VSyncMonitor(context, mVSyncListener);
|
| + mDIPScaleMonitor = new DIPScaleMonitor(this);
|
| mAccessibilityManager = (AccessibilityManager) mApplicationContext.getSystemService(
|
| Context.ACCESSIBILITY_SERVICE);
|
| }
|
| @@ -514,6 +516,8 @@ public class WindowAndroid {
|
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
| if (mTouchExplorationMonitor != null) mTouchExplorationMonitor.destroy();
|
| }
|
| +
|
| + mDIPScaleMonitor.onDestroy();
|
| }
|
|
|
| /**
|
| @@ -642,6 +646,23 @@ public class WindowAndroid {
|
| });
|
| }
|
|
|
| + // Device scale factor related methods.
|
| +
|
| + /**
|
| + * Returns current device scale factor, aka DIP scale or display density.
|
| + */
|
| + public float getDIPScale() {
|
| + return mDIPScaleMonitor.getDIPScale();
|
| + }
|
| +
|
| + public void addDIPScaleListener(DIPScaleListener listener) {
|
| + mDIPScaleMonitor.addObserver(listener);
|
| + }
|
| +
|
| + public void removeDIPScaleListener(DIPScaleListener listener) {
|
| + mDIPScaleMonitor.removeObserver(listener);
|
| + }
|
| +
|
| /**
|
| * Getter for the current context (not necessarily the application context).
|
| * Make no assumptions regarding what type of Context is returned here, it could be for example
|
|
|