| 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 #ifndef REMOTING_CLIENT_JNI_JNI_CLIENT_H_ | 5 #ifndef REMOTING_CLIENT_JNI_JNI_CLIENT_H_ |
| 6 #define REMOTING_CLIENT_JNI_JNI_CLIENT_H_ | 6 #define REMOTING_CLIENT_JNI_JNI_CLIENT_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void HandleExtensionMessage(const std::string& type, | 73 void HandleExtensionMessage(const std::string& type, |
| 74 const std::string& message); | 74 const std::string& message); |
| 75 | 75 |
| 76 // Register C++ methods exposed to Java using JNI. | 76 // Register C++ methods exposed to Java using JNI. |
| 77 static bool RegisterJni(JNIEnv* env); | 77 static bool RegisterJni(JNIEnv* env); |
| 78 | 78 |
| 79 // The following methods are exposed to Java via JNI. | 79 // The following methods are exposed to Java via JNI. |
| 80 | 80 |
| 81 void Connect(JNIEnv* env, | 81 void Connect(JNIEnv* env, |
| 82 const base::android::JavaParamRef<jobject>& caller, | 82 const base::android::JavaParamRef<jobject>& caller, |
| 83 jlong display_handler_ptr, | |
| 84 const base::android::JavaParamRef<jstring>& username, | 83 const base::android::JavaParamRef<jstring>& username, |
| 85 const base::android::JavaParamRef<jstring>& authToken, | 84 const base::android::JavaParamRef<jstring>& authToken, |
| 86 const base::android::JavaParamRef<jstring>& hostJid, | 85 const base::android::JavaParamRef<jstring>& hostJid, |
| 87 const base::android::JavaParamRef<jstring>& hostId, | 86 const base::android::JavaParamRef<jstring>& hostId, |
| 88 const base::android::JavaParamRef<jstring>& hostPubkey, | 87 const base::android::JavaParamRef<jstring>& hostPubkey, |
| 89 const base::android::JavaParamRef<jstring>& pairId, | 88 const base::android::JavaParamRef<jstring>& pairId, |
| 90 const base::android::JavaParamRef<jstring>& pairSecret, | 89 const base::android::JavaParamRef<jstring>& pairSecret, |
| 91 const base::android::JavaParamRef<jstring>& capabilities, | 90 const base::android::JavaParamRef<jstring>& capabilities, |
| 92 const base::android::JavaParamRef<jstring>& flags); | 91 const base::android::JavaParamRef<jstring>& flags); |
| 93 | 92 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // TODO(yuweih): Instead of exposing a weak pointer in the public API, | 150 // TODO(yuweih): Instead of exposing a weak pointer in the public API, |
| 152 // consider handling task posting inside the client. | 151 // consider handling task posting inside the client. |
| 153 base::WeakPtr<JniClient> GetWeakPtr(); | 152 base::WeakPtr<JniClient> GetWeakPtr(); |
| 154 | 153 |
| 155 private: | 154 private: |
| 156 ChromotingJniRuntime* runtime_; | 155 ChromotingJniRuntime* runtime_; |
| 157 | 156 |
| 158 // Reference to the Java client object. | 157 // Reference to the Java client object. |
| 159 base::android::ScopedJavaGlobalRef<jobject> java_client_; | 158 base::android::ScopedJavaGlobalRef<jobject> java_client_; |
| 160 | 159 |
| 160 std::unique_ptr<DisplayUpdaterFactory> display_handler_; |
| 161 |
| 161 // Deleted on UI thread. | 162 // Deleted on UI thread. |
| 162 std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_; | 163 std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_; |
| 163 | 164 |
| 164 // Deleted on Network thread. | 165 // Deleted on Network thread. |
| 165 std::unique_ptr<ChromotingJniInstance> session_; | 166 std::unique_ptr<ChromotingJniInstance> session_; |
| 166 | 167 |
| 167 // Holds pointer for the UI thread. | 168 // Holds pointer for the UI thread. |
| 168 base::WeakPtrFactory<JniClient> weak_factory_; | 169 base::WeakPtrFactory<JniClient> weak_factory_; |
| 169 | 170 |
| 170 DISALLOW_COPY_AND_ASSIGN(JniClient); | 171 DISALLOW_COPY_AND_ASSIGN(JniClient); |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 } // namespace remoting | 174 } // namespace remoting |
| 174 | 175 |
| 175 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ | 176 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ |
| OLD | NEW |