Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: remoting/client/jni/jni_client.h

Issue 2643483003: [Remoting Android] Refactor ClientTelemetryLogger (Closed)
Patch Set: PTAL Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/jni/connect_to_host_info.cc ('k') | remoting/client/jni/jni_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ChromotingJniRuntime; 18 class ChromotingJniRuntime;
19 class ChromotingJniInstance; 19 class ChromotingJniInstance;
20 class JniGlDisplayHandler; 20 class JniGlDisplayHandler;
21 class JniPairingSecretFetcher; 21 class JniPairingSecretFetcher;
22 22
23 struct ConnectToHostInfo;
24
23 // Houses resources scoped to a session and exposes JNI interface to the 25 // 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 26 // Java client during a session. All its methods should be invoked exclusively
25 // from the UI thread unless otherwise noted. 27 // from the UI thread unless otherwise noted.
26 class JniClient { 28 class JniClient {
27 public: 29 public:
28 JniClient(ChromotingJniRuntime* runtime, 30 JniClient(ChromotingJniRuntime* runtime,
29 base::android::ScopedJavaGlobalRef<jobject> java_client); 31 base::android::ScopedJavaGlobalRef<jobject> java_client);
30 virtual ~JniClient(); 32 virtual ~JniClient();
31 33
32 // TODO(yuweih): Put these arguments into a struct.
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 16 matching lines...) Expand all
74 // Passes on the deconstructed ExtensionMessage to the client to handle 64 // Passes on the deconstructed ExtensionMessage to the client to handle
75 // appropriately. 65 // appropriately.
76 void HandleExtensionMessage(const std::string& type, 66 void HandleExtensionMessage(const std::string& type,
77 const std::string& message); 67 const std::string& message);
78 68
79 // Register C++ methods exposed to Java using JNI. 69 // Register C++ methods exposed to Java using JNI.
80 static bool RegisterJni(JNIEnv* env); 70 static bool RegisterJni(JNIEnv* env);
81 71
82 // The following methods are exposed to Java via JNI. 72 // The following methods are exposed to Java via JNI.
83 73
74 // TODO(yuweih): Pass a class/struct from Java holding all these arguments.
84 void Connect(JNIEnv* env, 75 void Connect(JNIEnv* env,
85 const base::android::JavaParamRef<jobject>& caller, 76 const base::android::JavaParamRef<jobject>& caller,
86 const base::android::JavaParamRef<jstring>& username, 77 const base::android::JavaParamRef<jstring>& username,
87 const base::android::JavaParamRef<jstring>& authToken, 78 const base::android::JavaParamRef<jstring>& auth_token,
88 const base::android::JavaParamRef<jstring>& hostJid, 79 const base::android::JavaParamRef<jstring>& host_jid,
89 const base::android::JavaParamRef<jstring>& hostId, 80 const base::android::JavaParamRef<jstring>& host_id,
90 const base::android::JavaParamRef<jstring>& hostPubkey, 81 const base::android::JavaParamRef<jstring>& host_pubkey,
91 const base::android::JavaParamRef<jstring>& pairId, 82 const base::android::JavaParamRef<jstring>& pair_id,
92 const base::android::JavaParamRef<jstring>& pairSecret, 83 const base::android::JavaParamRef<jstring>& pair_secret,
93 const base::android::JavaParamRef<jstring>& capabilities, 84 const base::android::JavaParamRef<jstring>& capabilities,
94 const base::android::JavaParamRef<jstring>& flags, 85 const base::android::JavaParamRef<jstring>& flags,
95 const base::android::JavaParamRef<jstring>& host_version, 86 const base::android::JavaParamRef<jstring>& host_version,
96 const base::android::JavaParamRef<jstring>& host_os, 87 const base::android::JavaParamRef<jstring>& host_os,
97 const base::android::JavaParamRef<jstring>& host_os_version); 88 const base::android::JavaParamRef<jstring>& host_os_version);
98 89
99 void Disconnect(JNIEnv* env, 90 void Disconnect(JNIEnv* env,
100 const base::android::JavaParamRef<jobject>& caller); 91 const base::android::JavaParamRef<jobject>& caller);
101 92
102 void AuthenticationResponse( 93 void AuthenticationResponse(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Holds pointer for the UI thread. 165 // Holds pointer for the UI thread.
175 base::WeakPtr<JniClient> weak_ptr_; 166 base::WeakPtr<JniClient> weak_ptr_;
176 base::WeakPtrFactory<JniClient> weak_factory_; 167 base::WeakPtrFactory<JniClient> weak_factory_;
177 168
178 DISALLOW_COPY_AND_ASSIGN(JniClient); 169 DISALLOW_COPY_AND_ASSIGN(JniClient);
179 }; 170 };
180 171
181 } // namespace remoting 172 } // namespace remoting
182 173
183 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ 174 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_
OLDNEW
« no previous file with comments | « remoting/client/jni/connect_to_host_info.cc ('k') | remoting/client/jni/jni_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698