Chromium Code Reviews| 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/client/jni/connect_to_host_info.h" | |
|
Sergey Ulanov
2017/01/19 00:50:39
ConnectToHostInfo can be forward-declared.
https:/
Yuwei
2017/01/19 23:00:00
Done.
| |
| 13 #include "remoting/protocol/connection_to_host.h" | 14 #include "remoting/protocol/connection_to_host.h" |
| 14 #include "remoting/protocol/cursor_shape_stub.h" | 15 #include "remoting/protocol/cursor_shape_stub.h" |
| 15 | 16 |
| 16 namespace remoting { | 17 namespace remoting { |
| 17 | 18 |
| 18 class ChromotingJniRuntime; | 19 class ChromotingJniRuntime; |
| 19 class ChromotingJniInstance; | 20 class ChromotingJniInstance; |
| 20 class JniGlDisplayHandler; | 21 class JniGlDisplayHandler; |
| 21 class JniPairingSecretFetcher; | 22 class JniPairingSecretFetcher; |
| 22 | 23 |
| 23 // Houses resources scoped to a session and exposes JNI interface to the | 24 // Houses resources scoped to a session and exposes JNI interface to the |
| 24 // Java client during a session. All its methods should be invoked exclusively | 25 // Java client during a session. All its methods should be invoked exclusively |
| 25 // from the UI thread unless otherwise noted. | 26 // from the UI thread unless otherwise noted. |
| 26 class JniClient { | 27 class JniClient { |
| 27 public: | 28 public: |
| 28 JniClient(ChromotingJniRuntime* runtime, | 29 JniClient(ChromotingJniRuntime* runtime, |
| 29 base::android::ScopedJavaGlobalRef<jobject> java_client); | 30 base::android::ScopedJavaGlobalRef<jobject> java_client); |
| 30 virtual ~JniClient(); | 31 virtual ~JniClient(); |
| 31 | 32 |
| 32 // TODO(yuweih): Put these arguments into a struct. | 33 // TODO(yuweih): Put these arguments into a struct. |
|
Sergey Ulanov
2017/01/19 00:50:39
remove this TODO
Yuwei
2017/01/19 23:00:00
Done.
| |
| 33 // Initiates a connection with the specified host. To skip the attempt at | 34 // Initiates a connection with the specified host. To skip the attempt at |
| 34 // pair-based authentication, leave |pairing_id| and |pairing_secret| as | 35 // pair-based authentication, leave |pairing_id| and |pairing_secret| as |
| 35 // empty strings. | 36 // empty strings. |
| 36 void ConnectToHost(const std::string& username, | 37 void ConnectToHost(const ConnectToHostInfo& info); |
| 37 const std::string& auth_token, | |
| 38 const std::string& host_jid, | |
| 39 const std::string& host_id, | |
| 40 const std::string& host_pubkey, | |
| 41 const std::string& pairing_id, | |
| 42 const std::string& pairing_secret, | |
| 43 const std::string& capabilities, | |
| 44 const std::string& flags, | |
| 45 const std::string& host_version, | |
| 46 const std::string& host_os, | |
| 47 const std::string& host_os_version); | |
| 48 | 38 |
| 49 // Terminates any ongoing connection attempt and cleans up by nullifying | 39 // Terminates any ongoing connection attempt and cleans up by nullifying |
| 50 // |session_|. This is a no-op unless |session| is currently non-null. | 40 // |session_|. This is a no-op unless |session| is currently non-null. |
| 51 void DisconnectFromHost(); | 41 void DisconnectFromHost(); |
| 52 | 42 |
| 53 // Notifies Java code of the current connection status. Call on UI thread. | 43 // Notifies Java code of the current connection status. Call on UI thread. |
| 54 void OnConnectionState(protocol::ConnectionToHost::State state, | 44 void OnConnectionState(protocol::ConnectionToHost::State state, |
| 55 protocol::ErrorCode error); | 45 protocol::ErrorCode error); |
| 56 | 46 |
| 57 // Pops up a dialog box asking the user to enter a PIN. Call on UI thread. | 47 // Pops up a dialog box asking the user to enter a PIN. Call on UI thread. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 // Holds pointer for the UI thread. | 164 // Holds pointer for the UI thread. |
| 175 base::WeakPtr<JniClient> weak_ptr_; | 165 base::WeakPtr<JniClient> weak_ptr_; |
| 176 base::WeakPtrFactory<JniClient> weak_factory_; | 166 base::WeakPtrFactory<JniClient> weak_factory_; |
| 177 | 167 |
| 178 DISALLOW_COPY_AND_ASSIGN(JniClient); | 168 DISALLOW_COPY_AND_ASSIGN(JniClient); |
| 179 }; | 169 }; |
| 180 | 170 |
| 181 } // namespace remoting | 171 } // namespace remoting |
| 182 | 172 |
| 183 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ | 173 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ |
| OLD | NEW |