| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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/system_monitor/system_monitor.h" | |
| 6 #include "jni/SystemMonitor_jni.h" | |
| 7 | |
| 8 namespace base { | |
| 9 | |
| 10 namespace android { | |
| 11 | |
| 12 // Native implementation of SystemMonitor.java. | |
| 13 void OnBatteryChargingChanged(JNIEnv* env, jclass clazz) { | |
| 14 SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); | |
| 15 } | |
| 16 | |
| 17 void OnMainActivityResumed(JNIEnv* env, jclass clazz) { | |
| 18 SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::RESUME_EVENT); | |
| 19 } | |
| 20 | |
| 21 void OnMainActivitySuspended(JNIEnv* env, jclass clazz) { | |
| 22 SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::SUSPEND_EVENT); | |
| 23 } | |
| 24 | |
| 25 } // namespace android | |
| 26 | |
| 27 bool SystemMonitor::IsBatteryPower() { | |
| 28 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 29 return base::android::Java_SystemMonitor_isBatteryPower(env); | |
| 30 } | |
| 31 | |
| 32 bool RegisterSystemMonitor(JNIEnv* env) { | |
| 33 return base::android::RegisterNativesImpl(env); | |
| 34 } | |
| 35 | |
| 36 } // namespace base | |
| OLD | NEW |