Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Unified Diff: base/android/java_system.cc

Issue 1283543003: [Android] Add a java.lang.System wrapper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/java_system.h ('k') | base/base.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java_system.cc
diff --git a/base/android/java_system.cc b/base/android/java_system.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1c4e518edc5831ed33e4bb3dab6505435932152e
--- /dev/null
+++ b/base/android/java_system.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/android/java_system.h"
+
+#include "base/android/jni_string.h"
+#include "jni/System_jni.h"
+
+namespace base {
+namespace android {
+
+bool JavaSystem::Register(JNIEnv* env) {
+ return JNI_System::RegisterNativesImpl(env);
+}
+
+// static
+std::string JavaSystem::GetProperty(const base::StringPiece& property_name) {
+ DCHECK(!property_name.empty());
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jstring> jproperty_name =
+ ConvertUTF8ToJavaString(env, property_name);
+ ScopedJavaLocalRef<jstring> jproperty =
+ JNI_System::Java_System_getPropertyJLS_JLS(env, jproperty_name.obj());
+ return jproperty.is_null() ? std::string()
+ : ConvertJavaStringToUTF8(env, jproperty.obj());
+}
+
+} // namespace android
+} // namespace base
« no previous file with comments | « base/android/java_system.h ('k') | base/base.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698