| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "remoting/protocol/connection_to_host.h" | 13 #include "remoting/protocol/connection_to_host.h" |
| 14 #include "remoting/protocol/cursor_shape_stub.h" | 14 #include "remoting/protocol/cursor_shape_stub.h" |
| 15 | 15 |
| 16 namespace remoting { | 16 namespace remoting { |
| 17 | 17 |
| 18 class ChromotingClientRuntime; | 18 class ChromotingClientRuntime; |
| 19 class ChromotingJniInstance; | 19 class ChromotingSession; |
| 20 class JniGlDisplayHandler; | 20 class JniGlDisplayHandler; |
| 21 class JniPairingSecretFetcher; | 21 class JniPairingSecretFetcher; |
| 22 class AudioPlayerAndroid; |
| 22 | 23 |
| 23 struct ConnectToHostInfo; | 24 struct ConnectToHostInfo; |
| 24 | 25 |
| 25 // Houses resources scoped to a session and exposes JNI interface to the | 26 // Houses resources scoped to a session and exposes JNI interface to the |
| 26 // Java client during a session. All its methods should be invoked exclusively | 27 // Java client during a session. All its methods should be invoked exclusively |
| 27 // from the UI thread unless otherwise noted. | 28 // from the UI thread unless otherwise noted. |
| 28 class JniClient { | 29 class JniClient { |
| 29 public: | 30 public: |
| 30 JniClient(base::android::ScopedJavaGlobalRef<jobject> java_client); | 31 JniClient(base::android::ScopedJavaGlobalRef<jobject> java_client); |
| 31 virtual ~JniClient(); | 32 virtual ~JniClient(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // consider handling task posting inside the client. | 148 // consider handling task posting inside the client. |
| 148 base::WeakPtr<JniClient> GetWeakPtr(); | 149 base::WeakPtr<JniClient> GetWeakPtr(); |
| 149 | 150 |
| 150 private: | 151 private: |
| 151 ChromotingClientRuntime* runtime_; | 152 ChromotingClientRuntime* runtime_; |
| 152 | 153 |
| 153 // Reference to the Java client object. | 154 // Reference to the Java client object. |
| 154 base::android::ScopedJavaGlobalRef<jobject> java_client_; | 155 base::android::ScopedJavaGlobalRef<jobject> java_client_; |
| 155 | 156 |
| 156 std::unique_ptr<JniGlDisplayHandler> display_handler_; | 157 std::unique_ptr<JniGlDisplayHandler> display_handler_; |
| 158 std::unique_ptr<AudioPlayerAndroid> audio_player_; |
| 157 | 159 |
| 158 // Deleted on UI thread. | 160 // Deleted on UI thread. |
| 159 std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_; | 161 std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_; |
| 160 | 162 |
| 161 // Deleted on Network thread. | 163 // Deleted on Network thread. |
| 162 std::unique_ptr<ChromotingJniInstance> session_; | 164 std::unique_ptr<ChromotingSession> session_; |
| 163 | 165 |
| 164 // Holds pointer for the UI thread. | 166 // Holds pointer for the UI thread. |
| 165 base::WeakPtr<JniClient> weak_ptr_; | 167 base::WeakPtr<JniClient> weak_ptr_; |
| 166 base::WeakPtrFactory<JniClient> weak_factory_; | 168 base::WeakPtrFactory<JniClient> weak_factory_; |
| 167 | 169 |
| 168 DISALLOW_COPY_AND_ASSIGN(JniClient); | 170 DISALLOW_COPY_AND_ASSIGN(JniClient); |
| 169 }; | 171 }; |
| 170 | 172 |
| 171 } // namespace remoting | 173 } // namespace remoting |
| 172 | 174 |
| 173 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ | 175 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ |
| OLD | NEW |