OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/android/java_system.h" |
| 6 |
| 7 #include "base/android/jni_string.h" |
| 8 #include "jni/System_jni.h" |
| 9 |
| 10 namespace base { |
| 11 namespace android { |
| 12 |
| 13 bool JavaSystem::Register(JNIEnv* env) { |
| 14 return JNI_System::RegisterNativesImpl(env); |
| 15 } |
| 16 |
| 17 // static |
| 18 std::string JavaSystem::GetProperty(const base::StringPiece& property_name) { |
| 19 DCHECK(!property_name.empty()); |
| 20 JNIEnv* env = AttachCurrentThread(); |
| 21 ScopedJavaLocalRef<jstring> jproperty_name = |
| 22 ConvertUTF8ToJavaString(env, property_name); |
| 23 ScopedJavaLocalRef<jstring> jproperty = |
| 24 JNI_System::Java_System_getPropertyJLS_JLS(env, jproperty_name.obj()); |
| 25 return jproperty.is_null() ? std::string() |
| 26 : ConvertJavaStringToUTF8(env, jproperty.obj()); |
| 27 } |
| 28 |
| 29 } // namespace android |
| 30 } // namespace base |
OLD | NEW |