| 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..67cbce65697b11aa50dd08e4ca5d8bb3b8eecfd9 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,8 +4,13 @@
|
|
|
| package org.chromium.content_shell;
|
|
|
| +import android.graphics.Bitmap;
|
| +import android.os.Build;
|
| +import android.view.PointerIcon;
|
| import android.view.ViewGroup;
|
|
|
| +import org.chromium.base.test.util.CallbackHelper;
|
| +import org.chromium.blink_public.web.WebCursorInfoType;
|
| import org.chromium.ui.base.ViewAndroidDelegate;
|
|
|
| /**
|
| @@ -13,14 +18,54 @@ import org.chromium.ui.base.ViewAndroidDelegate;
|
| * Extended for testing.
|
| */
|
| public class ShellViewAndroidDelegate extends ViewAndroidDelegate {
|
| + /**
|
| + * CallbackHelper for cursor update.
|
| + */
|
| + public static class OnCursorUpdateHelper extends CallbackHelper {
|
| + private int mPointerType;
|
| + public void notifyCalled(int type) {
|
| + mPointerType = type;
|
| + notifyCalled();
|
| + }
|
| + public int getPointerType() {
|
| + assert getCallCount() > 0;
|
| + return mPointerType;
|
| + }
|
| + }
|
| +
|
| private final ViewGroup mContainerView;
|
| + private final OnCursorUpdateHelper mOnCursorUpdateHelper;
|
|
|
| public ShellViewAndroidDelegate(ViewGroup containerView) {
|
| mContainerView = containerView;
|
| + mOnCursorUpdateHelper = new OnCursorUpdateHelper();
|
| }
|
|
|
| @Override
|
| public ViewGroup getContainerView() {
|
| return mContainerView;
|
| }
|
| +
|
| + public OnCursorUpdateHelper getOnCursorUpdateHelper() {
|
| + return mOnCursorUpdateHelper;
|
| + }
|
| +
|
| + @Override
|
| + public void onCursorChangedToCustom(Bitmap customCursorBitmap, int hotspotX, int hotspotY) {
|
| + super.onCursorChangedToCustom(customCursorBitmap, hotspotX, hotspotY);
|
| + mOnCursorUpdateHelper.notifyCalled(WebCursorInfoType.TYPE_CUSTOM);
|
| + }
|
| +
|
| + @Override
|
| + public void onCursorChanged(int cursorType) {
|
| + super.onCursorChanged(cursorType);
|
| + mOnCursorUpdateHelper.notifyCalled(cursorType);
|
| + }
|
| +
|
| + @Override
|
| + public void updatePointerIcon(PointerIcon icon) {
|
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
| + getContainerView().setPointerIcon(icon);
|
| + }
|
| + }
|
| }
|
|
|