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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 public Point getCursorHotspot() { | 170 public Point getCursorHotspot() { |
167 return mCursorHotspot; | 171 return mCursorHotspot; |
168 } | 172 } |
169 | 173 |
170 /** Returns the current cursor shape. Called on the graphics thread. */ | 174 /** Returns the current cursor shape. Called on the graphics thread. */ |
171 public Bitmap getCursorBitmap() { | 175 public Bitmap getCursorBitmap() { |
172 return mCursorBitmap; | 176 return mCursorBitmap; |
173 } | 177 } |
174 | 178 |
175 @CalledByNative | 179 @CalledByNative |
| 180 private DesktopViewFactory createDesktopViewFactory() { |
| 181 return new DesktopViewFactory() { |
| 182 @Override |
| 183 public AbstractDesktopView createDesktopView(Context context) { |
| 184 return new DesktopView(context, Display.this); |
| 185 } |
| 186 }; |
| 187 } |
| 188 |
| 189 @CalledByNative |
176 private static Display createJavaDisplayObject(long nativeDisplayHandler) { | 190 private static Display createJavaDisplayObject(long nativeDisplayHandler) { |
177 return new Display(nativeDisplayHandler); | 191 return new Display(nativeDisplayHandler); |
178 } | 192 } |
179 | 193 |
180 /** Schedules a redraw on the native graphics thread. */ | 194 /** Schedules a redraw on the native graphics thread. */ |
181 private native void nativeScheduleRedraw(long nativeJniDisplayHandler); | 195 private native void nativeScheduleRedraw(long nativeJniDisplayHandler); |
182 } | 196 } |
OLD | NEW |