| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 org.chromium.base.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
| 8 import org.chromium.base.annotations.JNINamespace; | 8 import org.chromium.base.annotations.JNINamespace; |
| 9 import org.chromium.base.annotations.SuppressFBWarnings; | 9 import org.chromium.base.annotations.SuppressFBWarnings; |
| 10 import org.chromium.chromoting.CapabilityManager; | 10 import org.chromium.chromoting.CapabilityManager; |
| 11 import org.chromium.chromoting.InputStub; |
| 11 import org.chromium.chromoting.SessionAuthenticator; | 12 import org.chromium.chromoting.SessionAuthenticator; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Class to manage a client connection to the host. This class controls the life
time of the | 15 * Class to manage a client connection to the host. This class controls the life
time of the |
| 15 * corresponding C++ object which implements the connection. A new object should
be created for | 16 * corresponding C++ object which implements the connection. A new object should
be created for |
| 16 * each connection to the host, so that notifications from a connection are alwa
ys sent to the | 17 * each connection to the host, so that notifications from a connection are alwa
ys sent to the |
| 17 * right object. | 18 * right object. |
| 18 * This class is used entirely on the UI thread. | 19 * This class is used entirely on the UI thread. |
| 19 */ | 20 */ |
| 20 @JNINamespace("remoting") | 21 @JNINamespace("remoting") |
| 21 public class Client { | 22 public class Client implements InputStub { |
| 22 // Pointer to the C++ object, cast to a |long|. | 23 // Pointer to the C++ object, cast to a |long|. |
| 23 private long mNativeJniClient; | 24 private long mNativeJniClient; |
| 24 | 25 |
| 25 // Reference has to be kept until the lifecycle of Client ends. Code are cur
rently using | 26 // Reference has to be kept until the lifecycle of Client ends. Code are cur
rently using |
| 26 // getDisplay() without doing a null check. | 27 // getDisplay() without doing a null check. |
| 27 private Display mDisplay; | 28 private Display mDisplay; |
| 28 | 29 |
| 29 // The global Client instance (may be null). This needs to be a global singl
eton so that the | 30 // The global Client instance (may be null). This needs to be a global singl
eton so that the |
| 30 // Client can be passed between Activities. | 31 // Client can be passed between Activities. |
| 31 private static Client sClient; | 32 private static Client sClient; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 /** Passes touch event information to the native handling code. */ | 328 /** Passes touch event information to the native handling code. */ |
| 328 private native void nativeSendTouchEvent( | 329 private native void nativeSendTouchEvent( |
| 329 long nativeJniClient, int eventType, TouchEventData[] data); | 330 long nativeJniClient, int eventType, TouchEventData[] data); |
| 330 | 331 |
| 331 /** Native implementation of Client.enableVideoChannel() */ | 332 /** Native implementation of Client.enableVideoChannel() */ |
| 332 private native void nativeEnableVideoChannel(long nativeJniClient, boolean e
nable); | 333 private native void nativeEnableVideoChannel(long nativeJniClient, boolean e
nable); |
| 333 | 334 |
| 334 /** Passes extension message to the native code. */ | 335 /** Passes extension message to the native code. */ |
| 335 private native void nativeSendExtensionMessage(long nativeJniClient, String
type, String data); | 336 private native void nativeSendExtensionMessage(long nativeJniClient, String
type, String data); |
| 336 } | 337 } |
| OLD | NEW |