| 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_CHROMOTING_JNI_INSTANCE_H_ | 5 #ifndef REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_ |
| 6 #define REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_ | 6 #define REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } // namespace protocol | 30 } // namespace protocol |
| 31 | 31 |
| 32 // ClientUserInterface that indirectly makes and receives JNI calls. | 32 // ClientUserInterface that indirectly makes and receives JNI calls. |
| 33 class ChromotingJniInstance | 33 class ChromotingJniInstance |
| 34 : public ClientUserInterface, | 34 : public ClientUserInterface, |
| 35 public protocol::ClipboardStub, | 35 public protocol::ClipboardStub, |
| 36 public protocol::CursorShapeStub, | 36 public protocol::CursorShapeStub, |
| 37 public base::RefCountedThreadSafe<ChromotingJniInstance> { | 37 public base::RefCountedThreadSafe<ChromotingJniInstance> { |
| 38 public: | 38 public: |
| 39 // Initiates a connection with the specified host. Call from the UI thread. | 39 // Initiates a connection with the specified host. Call from the UI thread. |
| 40 ChromotingJniInstance( | 40 // The instance does not take ownership of |jni_runtime|. |
| 41 const char* username, | 41 ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, |
| 42 const char* auth_token, | 42 const char* username, |
| 43 const char* host_jid, | 43 const char* auth_token, |
| 44 const char* host_id, | 44 const char* host_jid, |
| 45 const char* host_pubkey); | 45 const char* host_id, |
| 46 const char* host_pubkey); |
| 46 | 47 |
| 47 // Terminates the current connection (if it hasn't already failed) and cleans | 48 // Terminates the current connection (if it hasn't already failed) and cleans |
| 48 // up. Must be called before destruction. | 49 // up. Must be called before destruction. |
| 49 void Cleanup(); | 50 void Cleanup(); |
| 50 | 51 |
| 51 // Provides the user's PIN and resumes the host authentication attempt. Call | 52 // Provides the user's PIN and resumes the host authentication attempt. Call |
| 52 // on the UI thread once the user has finished entering this PIN into the UI, | 53 // on the UI thread once the user has finished entering this PIN into the UI, |
| 53 // but only after the UI has been asked to provide a PIN (via FetchSecret()). | 54 // but only after the UI has been asked to provide a PIN (via FetchSecret()). |
| 54 void ProvideSecret(const char* pin); | 55 void ProvideSecret(const char* pin); |
| 55 | 56 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void ConnectToHostOnDisplayThread(); | 91 void ConnectToHostOnDisplayThread(); |
| 91 void ConnectToHostOnNetworkThread(); | 92 void ConnectToHostOnNetworkThread(); |
| 92 void DisconnectFromHostOnNetworkThread(); | 93 void DisconnectFromHostOnNetworkThread(); |
| 93 | 94 |
| 94 // Notifies the user interface that the user needs to enter a PIN. The | 95 // Notifies the user interface that the user needs to enter a PIN. The |
| 95 // current authentication attempt is put on hold until |callback| is invoked. | 96 // current authentication attempt is put on hold until |callback| is invoked. |
| 96 // May be called on any thread. | 97 // May be called on any thread. |
| 97 void FetchSecret(bool pairable, | 98 void FetchSecret(bool pairable, |
| 98 const protocol::SecretFetchedCallback& callback); | 99 const protocol::SecretFetchedCallback& callback); |
| 99 | 100 |
| 101 // Used to obtain task runner references and make calls to Java methods. |
| 102 ChromotingJniRuntime* jni_runtime_; |
| 103 |
| 100 // This group of variables is to be used on the display thread. | 104 // This group of variables is to be used on the display thread. |
| 101 scoped_refptr<FrameConsumerProxy> frame_consumer_; | 105 scoped_refptr<FrameConsumerProxy> frame_consumer_; |
| 102 scoped_ptr<JniFrameConsumer> view_; | 106 scoped_ptr<JniFrameConsumer> view_; |
| 103 scoped_ptr<base::WeakPtrFactory<JniFrameConsumer> > view_weak_factory_; | 107 scoped_ptr<base::WeakPtrFactory<JniFrameConsumer> > view_weak_factory_; |
| 104 | 108 |
| 105 // This group of variables is to be used on the network thread. | 109 // This group of variables is to be used on the network thread. |
| 106 scoped_ptr<ClientConfig> client_config_; | 110 scoped_ptr<ClientConfig> client_config_; |
| 107 scoped_ptr<ClientContext> client_context_; | 111 scoped_ptr<ClientContext> client_context_; |
| 108 scoped_ptr<protocol::ConnectionToHost> connection_; | 112 scoped_ptr<protocol::ConnectionToHost> connection_; |
| 109 scoped_ptr<ChromotingClient> client_; | 113 scoped_ptr<ChromotingClient> client_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 126 std::string host_pubkey_; | 130 std::string host_pubkey_; |
| 127 | 131 |
| 128 friend class base::RefCountedThreadSafe<ChromotingJniInstance>; | 132 friend class base::RefCountedThreadSafe<ChromotingJniInstance>; |
| 129 | 133 |
| 130 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); | 134 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); |
| 131 }; | 135 }; |
| 132 | 136 |
| 133 } // namespace remoting | 137 } // namespace remoting |
| 134 | 138 |
| 135 #endif | 139 #endif |
| OLD | NEW |