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

Side by Side 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, 4 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.content_shell; 5 package org.chromium.content_shell;
6 6
7 import android.graphics.Bitmap;
7 import android.view.ViewGroup; 8 import android.view.ViewGroup;
8 9
10 import org.chromium.base.test.util.CallbackHelper;
11 import org.chromium.blink_public.web.WebCursorInfoType;
9 import org.chromium.ui.base.ViewAndroidDelegate; 12 import org.chromium.ui.base.ViewAndroidDelegate;
10 13
11 /** 14 /**
12 * Implementation of the abstract class {@link ViewAndroidDelegate} for content shell. 15 * Implementation of the abstract class {@link ViewAndroidDelegate} for content shell.
13 * Extended for testing. 16 * Extended for testing.
14 */ 17 */
15 public class ShellViewAndroidDelegate extends ViewAndroidDelegate { 18 public class ShellViewAndroidDelegate extends ViewAndroidDelegate {
19 /**
20 * CallbackHelper for cursor update.
21 */
22 public static class OnCursorUpdateHelper extends CallbackHelper {
23 private int mPointerType;
24 public void notifyCalled(int type) {
25 mPointerType = type;
26 notifyCalled();
27 }
28 public int getPointerType() {
29 assert getCallCount() > 0;
30 return mPointerType;
31 }
32 }
33
16 private final ViewGroup mContainerView; 34 private final ViewGroup mContainerView;
35 private final OnCursorUpdateHelper mOnCursorUpdateHelper;
17 36
18 public ShellViewAndroidDelegate(ViewGroup containerView) { 37 public ShellViewAndroidDelegate(ViewGroup containerView) {
19 mContainerView = containerView; 38 mContainerView = containerView;
39 mOnCursorUpdateHelper = new OnCursorUpdateHelper();
20 } 40 }
21 41
22 @Override 42 @Override
23 public ViewGroup getContainerView() { 43 public ViewGroup getContainerView() {
24 return mContainerView; 44 return mContainerView;
25 } 45 }
46
47 public OnCursorUpdateHelper getOnCursorUpdateHelper() {
48 return mOnCursorUpdateHelper;
49 }
50
51 @Override
52 public void onCursorChangedToCustom(Bitmap customCursorBitmap, int hotspotX, int hotspotY) {
53 super.onCursorChangedToCustom(customCursorBitmap, hotspotX, hotspotY);
54 mOnCursorUpdateHelper.notifyCalled(WebCursorInfoType.TYPE_CUSTOM);
55 }
56
57 @Override
58 public void onCursorChanged(int cursorType) {
59 super.onCursorChanged(cursorType);
60 mOnCursorUpdateHelper.notifyCalled(cursorType);
61 }
26 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698