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

Side by Side Diff: remoting/host/android/jni_host.h

Issue 1888653002: [remoting android] Initialize It2Me host and implement Connect() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase/re-upload since Reitveld is confused Created 4 years, 8 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/host/BUILD.gn ('k') | remoting/host/android/jni_host.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_HOST_ANDROID_JNI_HOST_H_ 5 #ifndef REMOTING_HOST_ANDROID_JNI_HOST_H_
6 #define REMOTING_HOST_ANDROID_JNI_HOST_H_ 6 #define REMOTING_HOST_ANDROID_JNI_HOST_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory>
11
10 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop.h"
17 #include "remoting/host/it2me/it2me_host.h"
12 18
13 namespace remoting { 19 namespace remoting {
14 20
15 class JniHost { 21 class ChromotingHostContext;
22 class It2MeHostFactory;
23
24 class JniHost : public It2MeHost::Observer {
16 public: 25 public:
17 JniHost(); 26 JniHost();
18 ~JniHost(); 27 virtual ~JniHost();
19 28
20 // Register C++ methods exposed to Java using JNI. 29 // Register C++ methods exposed to Java using JNI.
21 static bool RegisterJni(JNIEnv* env); 30 static bool RegisterJni(JNIEnv* env);
22 31
23 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& caller); 32 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& caller);
24 33
34 void Connect(JNIEnv* env,
35 const base::android::JavaParamRef<jobject>& caller,
36 const base::android::JavaParamRef<jstring>& user_name,
37 const base::android::JavaParamRef<jstring>& auth_token);
38
39 void Disconnect(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& caller);
41
42 // It2MeHost::Observer implementation.
43 void OnClientAuthenticated(const std::string& client_username) override;
44 void OnStoreAccessCode(const std::string& access_code,
45 base::TimeDelta access_code_lifetime) override;
46 void OnNatPolicyChanged(bool nat_traversal_enabled) override;
47 void OnStateChanged(It2MeHostState state,
48 const std::string& error_message) override;
49
25 private: 50 private:
51 std::unique_ptr<base::MessageLoopForUI> ui_loop_;
52 std::unique_ptr<ChromotingHostContext> host_context_;
53 std::unique_ptr<It2MeHostFactory> factory_;
54 scoped_refptr<It2MeHost> it2me_host_;
55
56 // IT2Me Talk server configuration used by |it2me_host_| to connect.
57 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
58
59 base::WeakPtr<JniHost> weak_ptr_;
60 base::WeakPtrFactory<JniHost> weak_factory_;
61
26 DISALLOW_COPY_AND_ASSIGN(JniHost); 62 DISALLOW_COPY_AND_ASSIGN(JniHost);
27 }; 63 };
28 64
29 } // namespace remoting 65 } // namespace remoting
30 66
31 #endif // REMOTING_HOST_ANDROID_JNI_HOST_H_ 67 #endif // REMOTING_HOST_ANDROID_JNI_HOST_H_
OLDNEW
« no previous file with comments | « remoting/host/BUILD.gn ('k') | remoting/host/android/jni_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698