OLD | NEW |
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 #include "remoting/host/android/jni_host.h" | 5 #include "remoting/host/android/jni_host.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "jni/Host_jni.h" | 10 #include "jni/Host_jni.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 void JniHost::OnClientAuthenticated(const std::string& client_username) { | 103 void JniHost::OnClientAuthenticated(const std::string& client_username) { |
104 HOST_LOG << "OnClientAuthenticated: " << client_username; | 104 HOST_LOG << "OnClientAuthenticated: " << client_username; |
105 } | 105 } |
106 | 106 |
107 void JniHost::OnStoreAccessCode(const std::string& access_code, | 107 void JniHost::OnStoreAccessCode(const std::string& access_code, |
108 base::TimeDelta access_code_lifetime) { | 108 base::TimeDelta access_code_lifetime) { |
109 JNIEnv* env = base::android::AttachCurrentThread(); | 109 JNIEnv* env = base::android::AttachCurrentThread(); |
110 Java_Host_onAccessCodeReceived( | 110 Java_Host_onAccessCodeReceived( |
111 env, java_host_.obj(), ConvertUTF8ToJavaString(env, access_code).obj(), | 111 env, java_host_, ConvertUTF8ToJavaString(env, access_code), |
112 static_cast<int>(access_code_lifetime.InSeconds())); | 112 static_cast<int>(access_code_lifetime.InSeconds())); |
113 } | 113 } |
114 | 114 |
115 void JniHost::OnNatPolicyChanged(bool nat_traversal_enabled) { | 115 void JniHost::OnNatPolicyChanged(bool nat_traversal_enabled) { |
116 HOST_LOG << "OnNatPolicyChanged: " << nat_traversal_enabled; | 116 HOST_LOG << "OnNatPolicyChanged: " << nat_traversal_enabled; |
117 } | 117 } |
118 | 118 |
119 void JniHost::OnStateChanged(It2MeHostState state, | 119 void JniHost::OnStateChanged(It2MeHostState state, |
120 const std::string& error_message) { | 120 const std::string& error_message) { |
121 if (state == kDisconnected) { | 121 if (state == kDisconnected) { |
122 it2me_host_ = nullptr; | 122 it2me_host_ = nullptr; |
123 } | 123 } |
124 | 124 |
125 JNIEnv* env = base::android::AttachCurrentThread(); | 125 JNIEnv* env = base::android::AttachCurrentThread(); |
126 Java_Host_onStateChanged(env, java_host_.obj(), state, | 126 Java_Host_onStateChanged(env, java_host_, state, |
127 ConvertUTF8ToJavaString(env, error_message).obj()); | 127 ConvertUTF8ToJavaString(env, error_message)); |
128 } | 128 } |
129 | 129 |
130 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { | 130 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { |
131 return reinterpret_cast<intptr_t>(new JniHost(env, caller)); | 131 return reinterpret_cast<intptr_t>(new JniHost(env, caller)); |
132 } | 132 } |
133 | 133 |
134 } // namespace remoting | 134 } // namespace remoting |
OLD | NEW |