OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.chromoting.jni; | 5 package org.chromium.chromoting.jni; |
6 | 6 |
| 7 import android.content.Context; |
7 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
8 import android.graphics.Point; | 9 import android.graphics.Point; |
9 import android.os.Looper; | 10 import android.os.Looper; |
10 | 11 |
11 import org.chromium.base.Log; | 12 import org.chromium.base.Log; |
12 import org.chromium.base.annotations.CalledByNative; | 13 import org.chromium.base.annotations.CalledByNative; |
13 import org.chromium.base.annotations.JNINamespace; | 14 import org.chromium.base.annotations.JNINamespace; |
| 15 import org.chromium.chromoting.AbstractDesktopView; |
| 16 import org.chromium.chromoting.DesktopView; |
| 17 import org.chromium.chromoting.DesktopViewFactory; |
14 | 18 |
15 import java.nio.ByteBuffer; | 19 import java.nio.ByteBuffer; |
16 import java.nio.ByteOrder; | 20 import java.nio.ByteOrder; |
17 | 21 |
18 /** | 22 /** |
19 * This class is for drawing the desktop on the canvas and controlling the lifet
ime of the | 23 * This class is for drawing the desktop on the canvas and controlling the lifet
ime of the |
20 * corresponding C++ object. It only draws the desktop on the graphics (=display
) thread but also | 24 * corresponding C++ object. It only draws the desktop on the graphics (=display
) thread but also |
21 * has functions accessible on UI thread. | 25 * has functions accessible on UI thread. |
22 */ | 26 */ |
23 @JNINamespace("remoting") | 27 @JNINamespace("remoting") |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 public Point getCursorHotspot() { | 163 public Point getCursorHotspot() { |
160 return mCursorHotspot; | 164 return mCursorHotspot; |
161 } | 165 } |
162 | 166 |
163 /** Returns the current cursor shape. Called on the graphics thread. */ | 167 /** Returns the current cursor shape. Called on the graphics thread. */ |
164 public Bitmap getCursorBitmap() { | 168 public Bitmap getCursorBitmap() { |
165 return mCursorBitmap; | 169 return mCursorBitmap; |
166 } | 170 } |
167 | 171 |
168 @CalledByNative | 172 @CalledByNative |
| 173 private DesktopViewFactory createDesktopViewFactory() { |
| 174 return new DesktopViewFactory() { |
| 175 @Override |
| 176 public AbstractDesktopView createDesktopView(Context context) { |
| 177 return new DesktopView(context, Display.this); |
| 178 } |
| 179 }; |
| 180 } |
| 181 |
| 182 @CalledByNative |
169 private static Display createJavaDisplayObject(long nativeDisplayHandler) { | 183 private static Display createJavaDisplayObject(long nativeDisplayHandler) { |
170 return new Display(nativeDisplayHandler); | 184 return new Display(nativeDisplayHandler); |
171 } | 185 } |
172 | 186 |
173 /** Schedules a redraw on the native graphics thread. */ | 187 /** Schedules a redraw on the native graphics thread. */ |
174 private native void nativeScheduleRedraw(long nativeJniDisplayHandler); | 188 private native void nativeScheduleRedraw(long nativeJniDisplayHandler); |
175 } | 189 } |
OLD | NEW |