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

Unified Diff: base/system_monitor/system_monitor_android.cc

Issue 11027024: Android: Integrates native and java SystemMonitor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 years, 2 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
Index: base/system_monitor/system_monitor_android.cc
diff --git a/base/system_monitor/system_monitor_android.cc b/base/system_monitor/system_monitor_android.cc
index c86076d2a84baaaf1a20ec489ddbffdc46af7e7d..c33651cf32746c51c23be06c00acc8fc602e5a72 100644
--- a/base/system_monitor/system_monitor_android.cc
+++ b/base/system_monitor/system_monitor_android.cc
@@ -3,12 +3,28 @@
// found in the LICENSE file.
#include "base/system_monitor/system_monitor.h"
+#include "jni/SystemMonitor_jni.h"
namespace base {
+namespace android {
+
+// Native implementation of SystemMonitor.java.
+void OnBatteryChargingChanged(JNIEnv* env,
+ jclass clazz) {
+ SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT);
+}
+
+} // namespace android
+
bool SystemMonitor::IsBatteryPower() {
- NOTIMPLEMENTED();
- return true;
+ JNIEnv* env = base::android::AttachCurrentThread();
+ return base::android::Java_SystemMonitor_isBatteryPower(env);
+}
+
+// static
vandebo (ex-Chrome) 2012/10/05 15:35:40 nit: remove static - no longer a class member ;-)
bulach 2012/10/05 16:22:49 indeed! :) removed..
+bool RegisterSystemMonitor(JNIEnv* env) {
+ return base::android::RegisterNativesImpl(env);
}
} // namespace base
« base/system_monitor/system_monitor_android.h ('K') | « base/system_monitor/system_monitor_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698