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

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: removed whitespace changes Created 4 years, 1 month 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.VisibleForTesting; 30 import org.chromium.base.VisibleForTesting;
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 * Getter for the current context (not necessarily the application context). 657 * Getter for the current context (not necessarily the application context).
657 * Make no assumptions regarding what type of Context is returned here, it c ould be for example 658 * Make no assumptions regarding what type of Context is returned here, it c ould be for example
658 * an Activity or a Context created specifically to target an external displ ay. 659 * an Activity or a Context created specifically to target an external displ ay.
659 */ 660 */
660 public WeakReference<Context> getContext() { 661 public WeakReference<Context> getContext() {
661 // Return a new WeakReference to prevent clients from releasing our inte rnal WeakReference. 662 // Return a new WeakReference to prevent clients from releasing our inte rnal WeakReference.
662 return new WeakReference<Context>(mContextRef.get()); 663 return new WeakReference<Context>(mContextRef.get());
663 } 664 }
664 665
665 /** 666 /**
667 * Return the current window token, or null.
668 * TODO(liberato): explain this better. also mention embedders.t d
669 */
670 public IBinder getWindowToken() {
671 Context context = mContextRef.get();
672 if (context == null) return null;
673 Activity activity = activityFromContext(context);
674 if (activity == null) return null;
675
676 return activity.getWindow().getDecorView().getRootView().getWindowToken( );
boliu 2016/11/14 16:39:25 peekDecorView might be safer, but need a null chec
liberato (no reviews please) 2016/12/20 17:16:38 peekDecorView: done. getRootView: now that you men
677 }
678
679 /**
666 * Update whether the placeholder is 'drawn' based on whether an animation i s running 680 * Update whether the placeholder is 'drawn' based on whether an animation i s running
667 * or touch exploration is enabled - if either of those are true, we call 681 * or touch exploration is enabled - if either of those are true, we call
668 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf aceView, 682 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf aceView,
669 * and otherwise we call setWillNotDraw(true). 683 * and otherwise we call setWillNotDraw(true).
670 */ 684 */
671 private void refreshWillNotDraw() { 685 private void refreshWillNotDraw() {
672 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont ent.isEmpty(); 686 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont ent.isEmpty();
673 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) { 687 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) {
674 mAnimationPlaceholderView.setWillNotDraw(willNotDraw); 688 mAnimationPlaceholderView.setWillNotDraw(willNotDraw);
675 } 689 }
676 } 690 }
677 691
678 private native long nativeInit(); 692 private native long nativeInit();
679 private native void nativeOnVSync(long nativeWindowAndroid, 693 private native void nativeOnVSync(long nativeWindowAndroid,
680 long vsyncTimeMicros, 694 long vsyncTimeMicros,
681 long vsyncPeriodMicros); 695 long vsyncPeriodMicros);
682 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool ean visible); 696 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool ean visible);
683 private native void nativeOnActivityStopped(long nativeWindowAndroid); 697 private native void nativeOnActivityStopped(long nativeWindowAndroid);
684 private native void nativeOnActivityStarted(long nativeWindowAndroid); 698 private native void nativeOnActivityStarted(long nativeWindowAndroid);
685 private native void nativeDestroy(long nativeWindowAndroid); 699 private native void nativeDestroy(long nativeWindowAndroid);
686 700
687 } 701 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698