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

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

Issue 2765443004: AndroidOverlay implementation using Dialog. (Closed)
Patch Set: fixed gn Created 3 years, 8 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.Context; 13 import android.content.Context;
14 import android.content.ContextWrapper; 14 import android.content.ContextWrapper;
15 import android.content.Intent; 15 import android.content.Intent;
16 import android.content.pm.PackageManager; 16 import android.content.pm.PackageManager;
17 import android.os.Build; 17 import android.os.Build;
18 import android.os.Bundle; 18 import android.os.Bundle;
19 import android.os.IBinder;
19 import android.os.Process; 20 import android.os.Process;
20 import android.util.Log; 21 import android.util.Log;
21 import android.util.SparseArray; 22 import android.util.SparseArray;
22 import android.view.View; 23 import android.view.View;
23 import android.view.ViewGroup; 24 import android.view.ViewGroup;
24 import android.view.accessibility.AccessibilityManager; 25 import android.view.accessibility.AccessibilityManager;
25 26
26 import org.chromium.base.ApiCompatibilityUtils; 27 import org.chromium.base.ApiCompatibilityUtils;
27 import org.chromium.base.Callback; 28 import org.chromium.base.Callback;
28 import org.chromium.base.ObserverList; 29 import org.chromium.base.ObserverList;
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 * Getter for the current context (not necessarily the application context). 720 * Getter for the current context (not necessarily the application context).
720 * Make no assumptions regarding what type of Context is returned here, it c ould be for example 721 * Make no assumptions regarding what type of Context is returned here, it c ould be for example
721 * an Activity or a Context created specifically to target an external displ ay. 722 * an Activity or a Context created specifically to target an external displ ay.
722 */ 723 */
723 public WeakReference<Context> getContext() { 724 public WeakReference<Context> getContext() {
724 // Return a new WeakReference to prevent clients from releasing our inte rnal WeakReference. 725 // Return a new WeakReference to prevent clients from releasing our inte rnal WeakReference.
725 return new WeakReference<>(mContextRef.get()); 726 return new WeakReference<>(mContextRef.get());
726 } 727 }
727 728
728 /** 729 /**
730 * Return the current window token, or null.
731 */
732 @CalledByNative
733 private IBinder getWindowToken() {
734 Context context = mContextRef.get();
735 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.
736 Activity activity = activityFromContext(context);
737 if (activity == null) return null;
738 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.
739 if (decorView == null) return null;
740 return decorView.getWindowToken();
741 }
742
743 /**
729 * Update whether the placeholder is 'drawn' based on whether an animation i s running 744 * Update whether the placeholder is 'drawn' based on whether an animation i s running
730 * or touch exploration is enabled - if either of those are true, we call 745 * or touch exploration is enabled - if either of those are true, we call
731 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf aceView, 746 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf aceView,
732 * and otherwise we call setWillNotDraw(true). 747 * and otherwise we call setWillNotDraw(true).
733 */ 748 */
734 private void refreshWillNotDraw() { 749 private void refreshWillNotDraw() {
735 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont ent.isEmpty(); 750 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont ent.isEmpty();
736 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) { 751 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) {
737 mAnimationPlaceholderView.setWillNotDraw(willNotDraw); 752 mAnimationPlaceholderView.setWillNotDraw(willNotDraw);
738 } 753 }
(...skipping 14 matching lines...) Expand all
753 private native void nativeOnVSync(long nativeWindowAndroid, 768 private native void nativeOnVSync(long nativeWindowAndroid,
754 long vsyncTimeMicros, 769 long vsyncTimeMicros,
755 long vsyncPeriodMicros); 770 long vsyncPeriodMicros);
756 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool ean visible); 771 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool ean visible);
757 private native void nativeOnActivityStopped(long nativeWindowAndroid); 772 private native void nativeOnActivityStopped(long nativeWindowAndroid);
758 private native void nativeOnActivityStarted(long nativeWindowAndroid); 773 private native void nativeOnActivityStarted(long nativeWindowAndroid);
759 private native void nativeSetVSyncPaused(long nativeWindowAndroid, boolean p aused); 774 private native void nativeSetVSyncPaused(long nativeWindowAndroid, boolean p aused);
760 private native void nativeDestroy(long nativeWindowAndroid); 775 private native void nativeDestroy(long nativeWindowAndroid);
761 776
762 } 777 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698