| OLD | NEW |
| 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 #include "blimp/client/app/android/blimp_client_session_android.h" | 5 #include "blimp/client/app/android/blimp_client_session_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 GetOSVersionInfoForUserAgent()); | 86 GetOSVersionInfoForUserAgent()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void BlimpClientSessionAndroid::OnDisconnected(int result) { | 89 void BlimpClientSessionAndroid::OnDisconnected(int result) { |
| 90 JNIEnv* env = base::android::AttachCurrentThread(); | 90 JNIEnv* env = base::android::AttachCurrentThread(); |
| 91 Java_BlimpClientSession_onDisconnected( | 91 Java_BlimpClientSession_onDisconnected( |
| 92 env, java_obj_.obj(), base::android::ConvertUTF8ToJavaString( | 92 env, java_obj_.obj(), base::android::ConvertUTF8ToJavaString( |
| 93 env, net::ErrorToShortString(result)).obj()); | 93 env, net::ErrorToShortString(result)).obj()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void BlimpClientSessionAndroid::UpdateDebugInfo(int received, |
| 97 int sent, |
| 98 int commits) { |
| 99 JNIEnv* env = base::android::AttachCurrentThread(); |
| 100 Java_BlimpClientSession_updateDebugInfo(env, java_obj_.obj(), received, sent, |
| 101 commits); |
| 102 } |
| 103 |
| 96 void BlimpClientSessionAndroid::Destroy(JNIEnv* env, | 104 void BlimpClientSessionAndroid::Destroy(JNIEnv* env, |
| 97 const JavaParamRef<jobject>& jobj) { | 105 const JavaParamRef<jobject>& jobj) { |
| 98 delete this; | 106 delete this; |
| 99 } | 107 } |
| 100 | 108 |
| 101 void BlimpClientSessionAndroid::OnAssignmentConnectionAttempted( | 109 void BlimpClientSessionAndroid::OnAssignmentConnectionAttempted( |
| 102 AssignmentSource::Result result, | 110 AssignmentSource::Result result, |
| 103 const Assignment& assignment) { | 111 const Assignment& assignment) { |
| 104 // Notify the front end of the assignment result. | 112 // Notify the front end of the assignment result. |
| 105 std::string engine_ip = IPAddressToStringWithPort( | 113 std::string engine_ip = IPAddressToStringWithPort( |
| 106 assignment.engine_endpoint.address(), assignment.engine_endpoint.port()); | 114 assignment.engine_endpoint.address(), assignment.engine_endpoint.port()); |
| 107 JNIEnv* env = base::android::AttachCurrentThread(); | 115 JNIEnv* env = base::android::AttachCurrentThread(); |
| 108 Java_BlimpClientSession_onAssignmentReceived( | 116 Java_BlimpClientSession_onAssignmentReceived( |
| 109 env, java_obj_.obj(), static_cast<jint>(result), | 117 env, java_obj_.obj(), static_cast<jint>(result), |
| 110 base::android::ConvertUTF8ToJavaString(env, engine_ip).obj(), | 118 base::android::ConvertUTF8ToJavaString(env, engine_ip).obj(), |
| 111 base::android::ConvertUTF8ToJavaString(env, blimp::kEngineVersion).obj()); | 119 base::android::ConvertUTF8ToJavaString(env, blimp::kEngineVersion).obj()); |
| 112 | 120 |
| 113 BlimpClientSession::OnAssignmentConnectionAttempted(result, assignment); | 121 BlimpClientSession::OnAssignmentConnectionAttempted(result, assignment); |
| 114 } | 122 } |
| 115 | 123 |
| 124 void BlimpClientSessionAndroid::EnableDebugInfo( |
| 125 JNIEnv* env, |
| 126 const base::android::JavaParamRef<jobject>& jobj, |
| 127 jboolean enable) { |
| 128 BlimpClientSession::EnableDebugInfo(enable); |
| 129 } |
| 130 |
| 116 } // namespace client | 131 } // namespace client |
| 117 } // namespace blimp | 132 } // namespace blimp |
| OLD | NEW |