Guest Mode: input method should default to the underlying latin keyboard layout.
[chromium-blink-merge.git] / base / power_monitor / power_monitor_device_source_android.cc
blob4d9eb5278001ff7130b497275f0b8d663c4c96cf
1 // Copyright 2013 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.
5 #include "base/power_monitor/power_monitor_device_source_android.h"
7 #include "base/power_monitor/power_monitor.h"
8 #include "base/power_monitor/power_monitor_device_source.h"
9 #include "base/power_monitor/power_monitor_source.h"
10 #include "jni/PowerMonitor_jni.h"
12 namespace base {
14 // A helper function which is a friend of PowerMonitorSource.
15 void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) {
16 PowerMonitorSource::ProcessPowerEvent(event);
19 namespace android {
21 // Native implementation of PowerMonitor.java.
22 void OnBatteryChargingChanged(JNIEnv* env, jclass clazz) {
23 ProcessPowerEventHelper(PowerMonitorSource::POWER_STATE_EVENT);
26 void OnMainActivityResumed(JNIEnv* env, jclass clazz) {
27 ProcessPowerEventHelper(PowerMonitorSource::RESUME_EVENT);
30 void OnMainActivitySuspended(JNIEnv* env, jclass clazz) {
31 ProcessPowerEventHelper(PowerMonitorSource::SUSPEND_EVENT);
34 } // namespace android
36 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
37 JNIEnv* env = base::android::AttachCurrentThread();
38 return base::android::Java_PowerMonitor_isBatteryPower(env);
41 bool RegisterPowerMonitor(JNIEnv* env) {
42 return base::android::RegisterNativesImpl(env);
45 } // namespace base