| Index: base/power_monitor/power_monitor_android.cc
|
| diff --git a/base/system_monitor/system_monitor_android.cc b/base/power_monitor/power_monitor_android.cc
|
| similarity index 62%
|
| rename from base/system_monitor/system_monitor_android.cc
|
| rename to base/power_monitor/power_monitor_android.cc
|
| index 4e1a16b3e91f379f26bd829b55f62f08ca9cba46..640c9bf32529c4088bd64ac9167c5678421589a0 100644
|
| --- a/base/system_monitor/system_monitor_android.cc
|
| +++ b/base/power_monitor/power_monitor_android.cc
|
| @@ -2,22 +2,31 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/system_monitor/system_monitor.h"
|
| +#include "base/power_monitor/power_monitor.h"
|
| #include "jni/SystemMonitor_jni.h"
|
|
|
| namespace base {
|
|
|
| namespace android {
|
|
|
| +namespace {
|
| +
|
| +static base::PowerMonitor::Notifier* g_power_notifier = NULL;
|
| +
|
| +} // namespace
|
| +
|
| // Native implementation of SystemMonitor.java.
|
| void OnBatteryChargingChanged(JNIEnv* env,
|
| jclass clazz) {
|
| - SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT);
|
| + if (g_power_notifier == NULL)
|
| + g_power_notifier = base::PowerMonitor::GetInstance()->GetNotifierOnce();
|
| + if (g_power_notifier)
|
| + g_power_notifier->ProcessPowerEvent(base::PowerMonitor::POWER_STATE_EVENT);
|
| }
|
|
|
| } // namespace android
|
|
|
| -bool SystemMonitor::IsBatteryPower() {
|
| +bool PowerMonitor::IsBatteryPower() {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| return base::android::Java_SystemMonitor_isBatteryPower(env);
|
| }
|
|
|