| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 XmppSignalStrategy::XmppServerConfig xmpp_config = xmpp_server_config_; | 82 XmppSignalStrategy::XmppServerConfig xmpp_config = xmpp_server_config_; |
| 83 xmpp_config.username = ConvertJavaStringToUTF8(user_name); | 83 xmpp_config.username = ConvertJavaStringToUTF8(user_name); |
| 84 xmpp_config.auth_token = ConvertJavaStringToUTF8(auth_token); | 84 xmpp_config.auth_token = ConvertJavaStringToUTF8(auth_token); |
| 85 | 85 |
| 86 std::string directory_bot_jid = | 86 std::string directory_bot_jid = |
| 87 ServiceUrls::GetInstance()->directory_bot_jid(); | 87 ServiceUrls::GetInstance()->directory_bot_jid(); |
| 88 | 88 |
| 89 // Create the It2Me host and start connecting. | 89 // Create the It2Me host and start connecting. |
| 90 it2me_host_ = factory_->CreateIt2MeHost(host_context_->Copy(), weak_ptr_, | 90 it2me_host_ = factory_->CreateIt2MeHost(host_context_->Copy(), |
| 91 /*policy_service=*/nullptr, weak_ptr_, |
| 91 xmpp_config, directory_bot_jid); | 92 xmpp_config, directory_bot_jid); |
| 92 it2me_host_->Connect(); | 93 it2me_host_->Connect(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void JniHost::Disconnect(JNIEnv* env, | 96 void JniHost::Disconnect(JNIEnv* env, |
| 96 const base::android::JavaParamRef<jobject>& caller) { | 97 const base::android::JavaParamRef<jobject>& caller) { |
| 97 if (it2me_host_) { | 98 if (it2me_host_) { |
| 98 it2me_host_->Disconnect(); | 99 it2me_host_->Disconnect(); |
| 99 it2me_host_ = nullptr; | 100 it2me_host_ = nullptr; |
| 100 } | 101 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 125 JNIEnv* env = base::android::AttachCurrentThread(); | 126 JNIEnv* env = base::android::AttachCurrentThread(); |
| 126 Java_Host_onStateChanged(env, java_host_, state, | 127 Java_Host_onStateChanged(env, java_host_, state, |
| 127 ConvertUTF8ToJavaString(env, error_message)); | 128 ConvertUTF8ToJavaString(env, error_message)); |
| 128 } | 129 } |
| 129 | 130 |
| 130 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { | 131 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { |
| 131 return reinterpret_cast<intptr_t>(new JniHost(env, caller)); | 132 return reinterpret_cast<intptr_t>(new JniHost(env, caller)); |
| 132 } | 133 } |
| 133 | 134 |
| 134 } // namespace remoting | 135 } // namespace remoting |
| OLD | NEW |