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

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, 6 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.os.Build;
8 import android.view.PointerIcon;
7 import android.view.ViewGroup; 9 import android.view.ViewGroup;
8 10
9 import org.chromium.ui.base.ViewAndroidDelegate; 11 import org.chromium.ui.base.ViewAndroidDelegate;
10 12
11 /** 13 /**
12 * Implementation of the abstract class {@link ViewAndroidDelegate} for content shell. 14 * Implementation of the abstract class {@link ViewAndroidDelegate} for content shell.
13 * Extended for testing. 15 * Extended for testing.
14 */ 16 */
15 public class ShellViewAndroidDelegate extends ViewAndroidDelegate { 17 public class ShellViewAndroidDelegate extends ViewAndroidDelegate {
16 private final ViewGroup mContainerView; 18 private final ViewGroup mContainerView;
19 private Runnable mOnCursorUpdate;
17 20
18 public ShellViewAndroidDelegate(ViewGroup containerView) { 21 public ShellViewAndroidDelegate(ViewGroup containerView) {
19 mContainerView = containerView; 22 mContainerView = containerView;
23 mOnCursorUpdate = null;
20 } 24 }
21 25
22 @Override 26 @Override
23 public ViewGroup getContainerView() { 27 public ViewGroup getContainerView() {
24 return mContainerView; 28 return mContainerView;
25 } 29 }
30
31 public void setOnCursorUpdate(Runnable callback) {
32 mOnCursorUpdate = callback;
33 }
34
35 @Override
36 public void updatePointerIcon(PointerIcon icon) {
37 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
38 getContainerView().setPointerIcon(icon);
39 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.
40 }
41 }
26 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698