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

Side by Side Diff: ui/android/java/src/org/chromium/ui/base/WindowAndroid.java

Issue 2178973004: DialogSurfaceManager implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.ui.base; 5 package org.chromium.ui.base;
6 6
7 import android.animation.Animator; 7 import android.animation.Animator;
8 import android.animation.AnimatorListenerAdapter; 8 import android.animation.AnimatorListenerAdapter;
9 import android.annotation.SuppressLint; 9 import android.annotation.SuppressLint;
10 import android.annotation.TargetApi; 10 import android.annotation.TargetApi;
11 import android.app.Activity; 11 import android.app.Activity;
12 import android.app.PendingIntent; 12 import android.app.PendingIntent;
13 import android.content.ContentResolver; 13 import android.content.ContentResolver;
14 import android.content.Context; 14 import android.content.Context;
15 import android.content.ContextWrapper; 15 import android.content.ContextWrapper;
16 import android.content.Intent; 16 import android.content.Intent;
17 import android.content.pm.PackageManager; 17 import android.content.pm.PackageManager;
18 import android.os.Build; 18 import android.os.Build;
19 import android.os.Bundle; 19 import android.os.Bundle;
20 import android.os.IBinder;
20 import android.os.Process; 21 import android.os.Process;
21 import android.util.Log; 22 import android.util.Log;
22 import android.util.SparseArray; 23 import android.util.SparseArray;
23 import android.view.View; 24 import android.view.View;
24 import android.view.ViewGroup; 25 import android.view.ViewGroup;
25 import android.view.accessibility.AccessibilityManager; 26 import android.view.accessibility.AccessibilityManager;
26 27
27 import org.chromium.base.ApiCompatibilityUtils; 28 import org.chromium.base.ApiCompatibilityUtils;
28 import org.chromium.base.Callback; 29 import org.chromium.base.Callback;
29 import org.chromium.base.ObserverList; 30 import org.chromium.base.ObserverList;
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 * Getter for the current context (not necessarily the application context). 709 * Getter for the current context (not necessarily the application context).
709 * Make no assumptions regarding what type of Context is returned here, it c ould be for example 710 * Make no assumptions regarding what type of Context is returned here, it c ould be for example
710 * an Activity or a Context created specifically to target an external displ ay. 711 * an Activity or a Context created specifically to target an external displ ay.
711 */ 712 */
712 public WeakReference<Context> getContext() { 713 public WeakReference<Context> getContext() {
713 // Return a new WeakReference to prevent clients from releasing our inte rnal WeakReference. 714 // Return a new WeakReference to prevent clients from releasing our inte rnal WeakReference.
714 return new WeakReference<>(mContextRef.get()); 715 return new WeakReference<>(mContextRef.get());
715 } 716 }
716 717
717 /** 718 /**
719 * Return the current window token, or null.
720 */
721 @CalledByNative
722 private IBinder getWindowToken() {
723 Context context = mContextRef.get();
724 if (context == null) return null;
725 Activity activity = activityFromContext(context);
726 if (activity == null) return null;
727 View decorView = activity.getWindow().peekDecorView();
728 if (decorView == null) return null;
729 return decorView.getWindowToken();
730 }
731
732 /**
718 * Update whether the placeholder is 'drawn' based on whether an animation i s running 733 * Update whether the placeholder is 'drawn' based on whether an animation i s running
719 * or touch exploration is enabled - if either of those are true, we call 734 * or touch exploration is enabled - if either of those are true, we call
720 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf aceView, 735 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf aceView,
721 * and otherwise we call setWillNotDraw(true). 736 * and otherwise we call setWillNotDraw(true).
722 */ 737 */
723 private void refreshWillNotDraw() { 738 private void refreshWillNotDraw() {
724 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont ent.isEmpty(); 739 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont ent.isEmpty();
725 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) { 740 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) {
726 mAnimationPlaceholderView.setWillNotDraw(willNotDraw); 741 mAnimationPlaceholderView.setWillNotDraw(willNotDraw);
727 } 742 }
728 } 743 }
729 744
730 private native long nativeInit(int displayId); 745 private native long nativeInit(int displayId);
731 private native void nativeOnVSync(long nativeWindowAndroid, 746 private native void nativeOnVSync(long nativeWindowAndroid,
732 long vsyncTimeMicros, 747 long vsyncTimeMicros,
733 long vsyncPeriodMicros); 748 long vsyncPeriodMicros);
734 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool ean visible); 749 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool ean visible);
735 private native void nativeOnActivityStopped(long nativeWindowAndroid); 750 private native void nativeOnActivityStopped(long nativeWindowAndroid);
736 private native void nativeOnActivityStarted(long nativeWindowAndroid); 751 private native void nativeOnActivityStarted(long nativeWindowAndroid);
737 private native void nativeDestroy(long nativeWindowAndroid); 752 private native void nativeDestroy(long nativeWindowAndroid);
738 753
739 } 754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698