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

Side by Side Diff: base/system_monitor/system_monitor_android.cc

Issue 11538008: Fire SystemMonitor::{RESUME,SUSPEND}_EVENT on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update findbugs_known_bugs.txt Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/system_monitor/system_monitor.h" 5 #include "base/system_monitor/system_monitor.h"
6 #include "jni/SystemMonitor_jni.h" 6 #include "jni/SystemMonitor_jni.h"
7 7
8 namespace base { 8 namespace base {
9 9
10 namespace android { 10 namespace android {
11 11
12 // Native implementation of SystemMonitor.java. 12 // Native implementation of SystemMonitor.java.
13 void OnBatteryChargingChanged(JNIEnv* env, 13 void OnBatteryChargingChanged(JNIEnv* env, jclass clazz) {
14 jclass clazz) {
15 SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); 14 SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT);
16 } 15 }
17 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
18 } // namespace android 25 } // namespace android
19 26
20 bool SystemMonitor::IsBatteryPower() { 27 bool SystemMonitor::IsBatteryPower() {
21 JNIEnv* env = base::android::AttachCurrentThread(); 28 JNIEnv* env = base::android::AttachCurrentThread();
22 return base::android::Java_SystemMonitor_isBatteryPower(env); 29 return base::android::Java_SystemMonitor_isBatteryPower(env);
23 } 30 }
24 31
25 bool RegisterSystemMonitor(JNIEnv* env) { 32 bool RegisterSystemMonitor(JNIEnv* env) {
26 return base::android::RegisterNativesImpl(env); 33 return base::android::RegisterNativesImpl(env);
27 } 34 }
28 35
29 } // namespace base 36 } // namespace base
OLDNEW
« no previous file with comments | « base/android/java/src/org/chromium/base/SystemMonitor.java ('k') | build/android/findbugs_filter/findbugs_known_bugs.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698