Chromium Code Reviews| 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 d9771f74edd7707bc3043936bc23f221dfcc358f..2ab71e157974687daed7be040c82208229c8c99a 100644 |
| --- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
| +++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
| @@ -16,6 +16,7 @@ import android.content.Intent; |
| import android.content.pm.PackageManager; |
| import android.os.Build; |
| import android.os.Bundle; |
| +import android.os.IBinder; |
| import android.os.Process; |
| import android.util.Log; |
| import android.util.SparseArray; |
| @@ -726,6 +727,20 @@ public class WindowAndroid { |
| } |
| /** |
| + * Return the current window token, or null. |
| + */ |
| + @CalledByNative |
| + private IBinder getWindowToken() { |
| + Context context = mContextRef.get(); |
| + if (context == null) return null; |
|
boliu
2017/03/30 22:42:02
this check not needed, activityFromContext should
liberato (no reviews please)
2017/04/04 17:49:28
Done.
|
| + Activity activity = activityFromContext(context); |
| + if (activity == null) return null; |
| + View decorView = activity.getWindow().peekDecorView(); |
|
boliu
2017/03/30 22:42:02
actually need null check for getWindow? docs says
liberato (no reviews please)
2017/04/04 17:49:28
unclear. i'll add it.
|
| + if (decorView == null) return null; |
| + return decorView.getWindowToken(); |
| + } |
| + |
| + /** |
| * Update whether the placeholder is 'drawn' based on whether an animation is running |
| * or touch exploration is enabled - if either of those are true, we call |
| * setWillNotDraw(false) to ensure that the animation is drawn over the SurfaceView, |