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

Unified Diff: ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java

Issue 219963002: Update SharedDeviveDisplay from ScreenOrientationListener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
Index: ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
diff --git a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
index c154ea0b224ae684f7b41cd07bd2beae317199bd..5f7e1c5882160ce5431bdf3b78f0dd0e0140c87b 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
@@ -4,9 +4,7 @@
package org.chromium.ui.gfx;
-import android.content.ComponentCallbacks;
import android.content.Context;
-import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.Build;
@@ -27,7 +25,6 @@ import org.chromium.base.JNINamespace;
@JNINamespace("gfx")
public class DeviceDisplayInfo {
-
private final Context mAppContext;
private final WindowManager mWinManager;
private Point mTempPoint = new Point();
@@ -156,21 +153,11 @@ public class DeviceDisplayInfo {
return mAppContext.getResources().getConfiguration().smallestScreenWidthDp;
}
- private void registerListener() {
- mAppContext.registerComponentCallbacks(
- new ComponentCallbacks() {
- @Override
- public void onConfigurationChanged(Configuration configuration) {
- updateNativeSharedDisplayInfo();
- }
-
- @Override
- public void onLowMemory() {
- }
- });
- }
-
- private void updateNativeSharedDisplayInfo() {
+ /**
+ * Inform the native implementation to update its cached representation of
+ * the DeviceDisplayInfo values.
+ */
+ public void updateNativeSharedDisplayInfo() {
nativeUpdateSharedDeviceDisplayInfo(
getDisplayHeight(), getDisplayWidth(),
getPhysicalDisplayHeight(), getPhysicalDisplayWidth(),
@@ -188,17 +175,11 @@ public class DeviceDisplayInfo {
* @param context A context to use.
* @return DeviceDisplayInfo associated with a given Context.
*/
+ @CalledByNative
public static DeviceDisplayInfo create(Context context) {
return new DeviceDisplayInfo(context);
}
- @CalledByNative
- private static DeviceDisplayInfo createWithListener(Context context) {
- DeviceDisplayInfo deviceDisplayInfo = new DeviceDisplayInfo(context);
- deviceDisplayInfo.registerListener();
- return deviceDisplayInfo;
- }
-
private native void nativeUpdateSharedDeviceDisplayInfo(
int displayHeight, int displayWidth,
int physicalDisplayHeight, int physicalDisplayWidth,

Powered by Google App Engine
This is Rietveld 408576698