| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMOTING_JNI_INSTANCE_H_ | 5 #ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ |
| 6 #define REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ | 6 #define REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "remoting/client/chromoting_client.h" | 15 #include "remoting/client/chromoting_client.h" |
| 16 #include "remoting/client/client_context.h" | 16 #include "remoting/client/client_context.h" |
| 17 #include "remoting/client/client_telemetry_logger.h" |
| 17 #include "remoting/client/client_user_interface.h" | 18 #include "remoting/client/client_user_interface.h" |
| 19 #include "remoting/client/jni/connect_to_host_info.h" |
| 18 #include "remoting/proto/control.pb.h" | 20 #include "remoting/proto/control.pb.h" |
| 19 #include "remoting/proto/event.pb.h" | 21 #include "remoting/proto/event.pb.h" |
| 20 #include "remoting/protocol/clipboard_stub.h" | 22 #include "remoting/protocol/clipboard_stub.h" |
| 21 #include "remoting/protocol/cursor_shape_stub.h" | 23 #include "remoting/protocol/cursor_shape_stub.h" |
| 22 #include "remoting/signaling/xmpp_signal_strategy.h" | 24 #include "remoting/signaling/xmpp_signal_strategy.h" |
| 23 | 25 |
| 24 namespace remoting { | 26 namespace remoting { |
| 25 | 27 |
| 26 namespace protocol { | 28 namespace protocol { |
| 27 class ClipboardEvent; | 29 class ClipboardEvent; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 43 public protocol::ClipboardStub { | 45 public protocol::ClipboardStub { |
| 44 public: | 46 public: |
| 45 // Initiates a connection with the specified host. Call from the UI thread. | 47 // Initiates a connection with the specified host. Call from the UI thread. |
| 46 // The instance does not take ownership of |jni_runtime|. To connect with an | 48 // The instance does not take ownership of |jni_runtime|. To connect with an |
| 47 // unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings. | 49 // unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings. |
| 48 ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, | 50 ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, |
| 49 base::WeakPtr<JniClient> jni_client, | 51 base::WeakPtr<JniClient> jni_client, |
| 50 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher, | 52 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher, |
| 51 std::unique_ptr<protocol::CursorShapeStub> cursor_stub, | 53 std::unique_ptr<protocol::CursorShapeStub> cursor_stub, |
| 52 std::unique_ptr<protocol::VideoRenderer> video_renderer, | 54 std::unique_ptr<protocol::VideoRenderer> video_renderer, |
| 53 const std::string& username, | 55 const ConnectToHostInfo& info); |
| 54 const std::string& auth_token, | |
| 55 const std::string& host_jid, | |
| 56 const std::string& host_id, | |
| 57 const std::string& host_pubkey, | |
| 58 const std::string& pairing_id, | |
| 59 const std::string& pairing_secret, | |
| 60 const std::string& capabilities, | |
| 61 const std::string& flags, | |
| 62 const std::string& host_version, | |
| 63 const std::string& host_os, | |
| 64 const std::string& host_os_version); | |
| 65 | 56 |
| 66 ~ChromotingJniInstance() override; | 57 ~ChromotingJniInstance() override; |
| 67 | 58 |
| 68 // Starts the connection. Can be called on any thread. | 59 // Starts the connection. Can be called on any thread. |
| 69 void Connect(); | 60 void Connect(); |
| 70 | 61 |
| 71 // Terminates the current connection (if it hasn't already failed) and cleans | 62 // Terminates the current connection (if it hasn't already failed) and cleans |
| 72 // up. The instance will no longer be valid after calling this function. | 63 // up. The instance will no longer be valid after calling this function. |
| 73 // Must be called before destruction. | 64 // Must be called before destruction. |
| 74 void Disconnect(); | 65 void Disconnect(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Releases the resource in the right order. | 142 // Releases the resource in the right order. |
| 152 void ReleaseResources(); | 143 void ReleaseResources(); |
| 153 | 144 |
| 154 // Used to obtain task runner references and make calls to Java methods. | 145 // Used to obtain task runner references and make calls to Java methods. |
| 155 ChromotingJniRuntime* jni_runtime_; | 146 ChromotingJniRuntime* jni_runtime_; |
| 156 | 147 |
| 157 base::WeakPtr<JniClient> jni_client_; | 148 base::WeakPtr<JniClient> jni_client_; |
| 158 | 149 |
| 159 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher_; | 150 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher_; |
| 160 | 151 |
| 161 // ID of the host we are connecting to. | 152 ConnectToHostInfo connection_info_; |
| 162 std::string host_jid_; | |
| 163 | 153 |
| 164 protocol::ClientAuthenticationConfig client_auth_config_; | 154 protocol::ClientAuthenticationConfig client_auth_config_; |
| 165 | 155 |
| 166 std::string flags_; | |
| 167 | |
| 168 // This group of variables is to be used on the network thread. | 156 // This group of variables is to be used on the network thread. |
| 169 std::unique_ptr<ClientContext> client_context_; | 157 std::unique_ptr<ClientContext> client_context_; |
| 170 std::unique_ptr<protocol::PerformanceTracker> perf_tracker_; | 158 std::unique_ptr<protocol::PerformanceTracker> perf_tracker_; |
| 171 std::unique_ptr<protocol::CursorShapeStub> cursor_shape_stub_; | 159 std::unique_ptr<protocol::CursorShapeStub> cursor_shape_stub_; |
| 172 std::unique_ptr<protocol::VideoRenderer> video_renderer_; | 160 std::unique_ptr<protocol::VideoRenderer> video_renderer_; |
| 173 std::unique_ptr<ChromotingClient> client_; | 161 std::unique_ptr<ChromotingClient> client_; |
| 174 XmppSignalStrategy::XmppServerConfig xmpp_config_; | 162 XmppSignalStrategy::XmppServerConfig xmpp_config_; |
| 175 std::unique_ptr<XmppSignalStrategy> signaling_; // Must outlive client_ | 163 std::unique_ptr<XmppSignalStrategy> signaling_; // Must outlive client_ |
| 176 protocol::ThirdPartyTokenFetchedCallback third_party_token_fetched_callback_; | 164 protocol::ThirdPartyTokenFetchedCallback third_party_token_fetched_callback_; |
| 177 | 165 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 193 | 181 |
| 194 // The set of capabilities supported by the client. Accessed on the network | 182 // The set of capabilities supported by the client. Accessed on the network |
| 195 // thread. Once SetCapabilities() is called, this will contain the negotiated | 183 // thread. Once SetCapabilities() is called, this will contain the negotiated |
| 196 // set of capabilities for this remoting session. | 184 // set of capabilities for this remoting session. |
| 197 std::string capabilities_; | 185 std::string capabilities_; |
| 198 | 186 |
| 199 // Indicates whether the client is connected to the host. Used on network | 187 // Indicates whether the client is connected to the host. Used on network |
| 200 // thread. | 188 // thread. |
| 201 bool connected_ = false; | 189 bool connected_ = false; |
| 202 | 190 |
| 203 // TODO(BUG 680752): Remove these. | 191 std::unique_ptr<ClientTelemetryLogger> logger_; |
| 204 std::string host_version_; | |
| 205 std::string host_os_; | |
| 206 std::string host_os_version_; | |
| 207 | 192 |
| 208 base::WeakPtr<ChromotingJniInstance> weak_ptr_; | 193 base::WeakPtr<ChromotingJniInstance> weak_ptr_; |
| 209 base::WeakPtrFactory<ChromotingJniInstance> weak_factory_; | 194 base::WeakPtrFactory<ChromotingJniInstance> weak_factory_; |
| 210 | 195 |
| 211 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); | 196 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); |
| 212 }; | 197 }; |
| 213 | 198 |
| 214 } // namespace remoting | 199 } // namespace remoting |
| 215 | 200 |
| 216 #endif // REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ | 201 #endif // REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ |
| OLD | NEW |