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 30 matching lines...) Expand all Loading... |
41 // Initiates a connection with the specified host. Call from the UI thread. | 41 // Initiates a connection with the specified host. Call from the UI thread. |
42 // The instance does not take ownership of |jni_runtime|. To connect with an | 42 // The instance does not take ownership of |jni_runtime|. To connect with an |
43 // unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings. | 43 // unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings. |
44 ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, | 44 ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, |
45 const char* username, | 45 const char* username, |
46 const char* auth_token, | 46 const char* auth_token, |
47 const char* host_jid, | 47 const char* host_jid, |
48 const char* host_id, | 48 const char* host_id, |
49 const char* host_pubkey, | 49 const char* host_pubkey, |
50 const char* pairing_id, | 50 const char* pairing_id, |
51 const char* pairing_secret); | 51 const char* pairing_secret, |
| 52 const char* capabilities); |
52 | 53 |
53 // Terminates the current connection (if it hasn't already failed) and cleans | 54 // Terminates the current connection (if it hasn't already failed) and cleans |
54 // up. Must be called before destruction. | 55 // up. Must be called before destruction. |
55 void Disconnect(); | 56 void Disconnect(); |
56 | 57 |
57 // Requests the android app to fetch a third-party token. | 58 // Requests the android app to fetch a third-party token. |
58 void FetchThirdPartyToken( | 59 void FetchThirdPartyToken( |
59 const GURL& token_url, | 60 const GURL& token_url, |
60 const std::string& client_id, | 61 const std::string& client_id, |
61 const std::string& scope, | 62 const std::string& scope, |
(...skipping 17 matching lines...) Expand all Loading... |
79 void SendMouseEvent(int x, int y, | 80 void SendMouseEvent(int x, int y, |
80 protocol::MouseEvent_MouseButton button, | 81 protocol::MouseEvent_MouseButton button, |
81 bool button_down); | 82 bool button_down); |
82 void SendMouseWheelEvent(int delta_x, int delta_y); | 83 void SendMouseWheelEvent(int delta_x, int delta_y); |
83 | 84 |
84 // Sends the provided keyboard scan code to the host. | 85 // Sends the provided keyboard scan code to the host. |
85 bool SendKeyEvent(int key_code, bool key_down); | 86 bool SendKeyEvent(int key_code, bool key_down); |
86 | 87 |
87 void SendTextEvent(const std::string& text); | 88 void SendTextEvent(const std::string& text); |
88 | 89 |
| 90 void SendClientMessage(const std::string& type, const std::string& data); |
| 91 |
89 // Records paint time for statistics logging, if enabled. May be called from | 92 // Records paint time for statistics logging, if enabled. May be called from |
90 // any thread. | 93 // any thread. |
91 void RecordPaintTime(int64 paint_time_ms); | 94 void RecordPaintTime(int64 paint_time_ms); |
92 | 95 |
93 // ClientUserInterface implementation. | 96 // ClientUserInterface implementation. |
94 virtual void OnConnectionState( | 97 virtual void OnConnectionState( |
95 protocol::ConnectionToHost::State state, | 98 protocol::ConnectionToHost::State state, |
96 protocol::ErrorCode error) OVERRIDE; | 99 protocol::ErrorCode error) OVERRIDE; |
97 virtual void OnConnectionReady(bool ready) OVERRIDE; | 100 virtual void OnConnectionReady(bool ready) OVERRIDE; |
98 virtual void OnRouteChanged(const std::string& channel_name, | 101 virtual void OnRouteChanged(const std::string& channel_name, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 bool create_pairing_; | 176 bool create_pairing_; |
174 | 177 |
175 // The device name to appear in the paired-clients list. Accessed on the | 178 // The device name to appear in the paired-clients list. Accessed on the |
176 // network thread. | 179 // network thread. |
177 std::string device_name_; | 180 std::string device_name_; |
178 | 181 |
179 // If this is true, performance statistics will be periodically written to | 182 // If this is true, performance statistics will be periodically written to |
180 // the Android log. Used on the network thread. | 183 // the Android log. Used on the network thread. |
181 bool stats_logging_enabled_; | 184 bool stats_logging_enabled_; |
182 | 185 |
| 186 // The set of capabilities supported by the client. Accessed on the network |
| 187 // thread. Once SetCapabilities() is called, this will contain the negotiated |
| 188 // set of capabilities for this remoting session. |
| 189 std::string capabilities_; |
| 190 |
183 friend class base::RefCountedThreadSafe<ChromotingJniInstance>; | 191 friend class base::RefCountedThreadSafe<ChromotingJniInstance>; |
184 | 192 |
185 base::WeakPtrFactory<ChromotingJniInstance> weak_factory_; | 193 base::WeakPtrFactory<ChromotingJniInstance> weak_factory_; |
186 | 194 |
187 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); | 195 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); |
188 }; | 196 }; |
189 | 197 |
190 } // namespace remoting | 198 } // namespace remoting |
191 | 199 |
192 #endif | 200 #endif |
OLD | NEW |