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

Unified Diff: content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java

Issue 2878403002: Support setting mouse cursor icon in Android N. (Closed)
Patch Set: Support setting mouse cursor icon in Android N Created 3 years, 7 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: content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java b/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
index 0e51e9d893b04fb4d382b038e74ed56bd5684c27..d4a76e771a337085e624b16a70cd35f678fc6d9d 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
@@ -4,6 +4,8 @@
package org.chromium.content_shell;
+import android.os.Build;
+import android.view.PointerIcon;
import android.view.ViewGroup;
import org.chromium.ui.base.ViewAndroidDelegate;
@@ -14,13 +16,27 @@ import org.chromium.ui.base.ViewAndroidDelegate;
*/
public class ShellViewAndroidDelegate extends ViewAndroidDelegate {
private final ViewGroup mContainerView;
+ private Runnable mOnCursorUpdate;
public ShellViewAndroidDelegate(ViewGroup containerView) {
mContainerView = containerView;
+ mOnCursorUpdate = null;
}
@Override
public ViewGroup getContainerView() {
return mContainerView;
}
+
+ public void setOnCursorUpdate(Runnable callback) {
+ mOnCursorUpdate = callback;
+ }
+
+ @Override
+ public void updatePointerIcon(PointerIcon icon) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ getContainerView().setPointerIcon(icon);
+ if (mOnCursorUpdate != null) mOnCursorUpdate.run();
boliu 2017/05/31 16:30:03 generally, the pattern is this class holds a Callb
jaebaek 2017/06/01 06:20:56 Done.
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698