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..30b64790d761e9e6945cd1ed93a3c195fb5d8360 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); |
} |
@@ -642,6 +644,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 addDisplayObserver(DisplayObserver observer) { |
boliu
2016/09/15 05:27:41
probably should add a note that this observer is o
Tima Vaisburd
2016/09/16 23:59:26
Said something in the // comment above..
|
+ mDIPScaleMonitor.addObserver(observer); |
+ } |
+ |
+ public void removeDisplayObserver(DisplayObserver observer) { |
+ mDIPScaleMonitor.removeObserver(observer); |
+ } |
+ |
/** |
* 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 |