| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/client/jni/chromoting_jni_runtime.h" | 5 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/library_loader/library_loader_hooks.h" | 10 #include "base/android/library_loader/library_loader_hooks.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 static void OnAuthTokenFetched(JNIEnv* env, | 54 static void OnAuthTokenFetched(JNIEnv* env, |
| 55 const JavaParamRef<jclass>& clazz, | 55 const JavaParamRef<jclass>& clazz, |
| 56 const JavaParamRef<jstring>& token) { | 56 const JavaParamRef<jstring>& token) { |
| 57 ChromotingJniRuntime* runtime = remoting::ChromotingJniRuntime::GetInstance(); | 57 ChromotingJniRuntime* runtime = remoting::ChromotingJniRuntime::GetInstance(); |
| 58 runtime->network_task_runner()->PostTask( | 58 runtime->network_task_runner()->PostTask( |
| 59 FROM_HERE, base::Bind(&HandleAuthTokenOnNetworkThread, | 59 FROM_HERE, base::Bind(&HandleAuthTokenOnNetworkThread, |
| 60 ConvertJavaStringToUTF8(env, token))); | 60 ConvertJavaStringToUTF8(env, token))); |
| 61 } | 61 } |
| 62 | 62 |
| 63 static void UseOpenGlRenderer(JNIEnv* env, const JavaParamRef<jclass>& jcaller, |
| 64 jboolean useOpenGl) { |
| 65 remoting::ChromotingJniRuntime::GetInstance()->use_opengl_ = useOpenGl; |
| 66 } |
| 67 |
| 63 // ChromotingJniRuntime implementation. | 68 // ChromotingJniRuntime implementation. |
| 64 | 69 |
| 65 // static | 70 // static |
| 66 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { | 71 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { |
| 67 return base::Singleton<ChromotingJniRuntime>::get(); | 72 return base::Singleton<ChromotingJniRuntime>::get(); |
| 68 } | 73 } |
| 69 | 74 |
| 70 ChromotingJniRuntime::ChromotingJniRuntime() { | 75 ChromotingJniRuntime::ChromotingJniRuntime() { |
| 71 // Grab or create the threads. | 76 // Grab or create the threads. |
| 72 // TODO(nicholss): We could runtime this as a constructor argument when jni | 77 // TODO(nicholss): We could runtime this as a constructor argument when jni |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 logger_->Start( | 137 logger_->Start( |
| 133 base::WrapUnique( | 138 base::WrapUnique( |
| 134 new ChromiumUrlRequestFactory(runtime_->url_requester())), | 139 new ChromiumUrlRequestFactory(runtime_->url_requester())), |
| 135 kTelemetryBaseUrl); | 140 kTelemetryBaseUrl); |
| 136 logger_->SetAuthClosure( | 141 logger_->SetAuthClosure( |
| 137 base::Bind(&ChromotingJniRuntime::FetchAuthToken, | 142 base::Bind(&ChromotingJniRuntime::FetchAuthToken, |
| 138 base::Unretained(this))); | 143 base::Unretained(this))); |
| 139 } | 144 } |
| 140 | 145 |
| 141 } // namespace remoting | 146 } // namespace remoting |
| OLD | NEW |