| 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; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** Returns whether the client is connected. */ | 84 /** Returns whether the client is connected. */ |
| 85 public boolean isConnected() { | 85 public boolean isConnected() { |
| 86 return mConnected; | 86 return mConnected; |
| 87 } | 87 } |
| 88 | 88 |
| 89 /** Attempts to form a connection to the user-selected host. */ | 89 /** Attempts to form a connection to the user-selected host. */ |
| 90 public void connectToHost(String username, String authToken, String hostJid, | 90 public void connectToHost(String username, String authToken, String hostJid, |
| 91 String hostId, String hostPubkey, SessionAuthenticator authenticator
, String flags, | 91 String hostId, String hostPubkey, SessionAuthenticator authenticator
, String flags, |
| 92 ConnectionListener listener) { | 92 String hostVersion, String hostOs, String hostOsVersion, ConnectionL
istener listener) { |
| 93 disconnectFromHost(); | 93 disconnectFromHost(); |
| 94 | 94 |
| 95 mConnectionListener = listener; | 95 mConnectionListener = listener; |
| 96 mAuthenticator = authenticator; | 96 mAuthenticator = authenticator; |
| 97 nativeConnect(mNativeJniClient, username, authToken, hostJid, | 97 nativeConnect(mNativeJniClient, username, authToken, hostJid, |
| 98 hostId, hostPubkey, mAuthenticator.getPairingId(hostId), | 98 hostId, hostPubkey, mAuthenticator.getPairingId(hostId), |
| 99 mAuthenticator.getPairingSecret(hostId), mCapabilityManager.getL
ocalCapabilities(), | 99 mAuthenticator.getPairingSecret(hostId), mCapabilityManager.getL
ocalCapabilities(), |
| 100 flags); | 100 flags, hostVersion, hostOs, hostOsVersion); |
| 101 mConnected = true; | 101 mConnected = true; |
| 102 } | 102 } |
| 103 | 103 |
| 104 /** Severs the connection and cleans up. */ | 104 /** Severs the connection and cleans up. */ |
| 105 public void disconnectFromHost() { | 105 public void disconnectFromHost() { |
| 106 if (!mConnected) { | 106 if (!mConnected) { |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 | 109 |
| 110 mConnectionListener.onConnectionState( | 110 mConnectionListener.onConnectionState( |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 nativeSendExtensionMessage(mNativeJniClient, type, data); | 289 nativeSendExtensionMessage(mNativeJniClient, type, data); |
| 290 } | 290 } |
| 291 | 291 |
| 292 private native long nativeInit(); | 292 private native long nativeInit(); |
| 293 | 293 |
| 294 private native void nativeDestroy(long nativeJniClient); | 294 private native void nativeDestroy(long nativeJniClient); |
| 295 | 295 |
| 296 /** Performs the native portion of the connection. */ | 296 /** Performs the native portion of the connection. */ |
| 297 private native void nativeConnect(long nativeJniClient, | 297 private native void nativeConnect(long nativeJniClient, |
| 298 String username, String authToken, String hostJid, String hostId, St
ring hostPubkey, | 298 String username, String authToken, String hostJid, String hostId, St
ring hostPubkey, |
| 299 String pairId, String pairSecret, String capabilities, String flags)
; | 299 String pairId, String pairSecret, String capabilities, String flags, |
| 300 String hostVersion, String hostOs, String hostOsVersion); |
| 300 | 301 |
| 301 /** Native implementation of Client.handleAuthenticationResponse(). */ | 302 /** Native implementation of Client.handleAuthenticationResponse(). */ |
| 302 private native void nativeAuthenticationResponse( | 303 private native void nativeAuthenticationResponse( |
| 303 long nativeJniClient, String pin, boolean createPair, String deviceN
ame); | 304 long nativeJniClient, String pin, boolean createPair, String deviceN
ame); |
| 304 | 305 |
| 305 /** Performs the native portion of the cleanup. */ | 306 /** Performs the native portion of the cleanup. */ |
| 306 private native void nativeDisconnect(long nativeJniClient); | 307 private native void nativeDisconnect(long nativeJniClient); |
| 307 | 308 |
| 308 /** Passes authentication data to the native handling code. */ | 309 /** Passes authentication data to the native handling code. */ |
| 309 private native void nativeOnThirdPartyTokenFetched( | 310 private native void nativeOnThirdPartyTokenFetched( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 326 /** Passes touch event information to the native handling code. */ | 327 /** Passes touch event information to the native handling code. */ |
| 327 private native void nativeSendTouchEvent( | 328 private native void nativeSendTouchEvent( |
| 328 long nativeJniClient, int eventType, TouchEventData[] data); | 329 long nativeJniClient, int eventType, TouchEventData[] data); |
| 329 | 330 |
| 330 /** Native implementation of Client.enableVideoChannel() */ | 331 /** Native implementation of Client.enableVideoChannel() */ |
| 331 private native void nativeEnableVideoChannel(long nativeJniClient, boolean e
nable); | 332 private native void nativeEnableVideoChannel(long nativeJniClient, boolean e
nable); |
| 332 | 333 |
| 333 /** Passes extension message to the native code. */ | 334 /** Passes extension message to the native code. */ |
| 334 private native void nativeSendExtensionMessage(long nativeJniClient, String
type, String data); | 335 private native void nativeSendExtensionMessage(long nativeJniClient, String
type, String data); |
| 335 } | 336 } |
| OLD | NEW |