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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/system_monitor/system_monitor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
7 namespace base { 8 namespace base {
9 namespace android {
10
11 static bool g_is_battery_charging = false;
12 void OnBatteryChargingChanged(JNIEnv* env,
13 jclass clazz,
14 jboolean is_charging) {
15 g_is_battery_charging = is_charging;
16 SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT);
17 }
18
19 } // namespace android
8 20
9 bool SystemMonitor::IsBatteryPower() { 21 bool SystemMonitor::IsBatteryPower() {
10 NOTIMPLEMENTED(); 22 return base::android::g_is_battery_charging;
Satish 2012/10/04 11:09:51 Since IsBatteryPower() is a querying API, I think
bulach 2012/10/04 11:16:32 hmm, I'm not sure if that would save us anything..
Satish 2012/10/04 11:31:07 Ah yes I missed the part about informing power sta
bulach 2012/10/04 13:58:50 Yes, good point about the global variable. rather
11 return true; 23 }
24
25 bool SystemMonitor::RegisterSystemMonitor(JNIEnv* env) {
26 return base::android::RegisterNativesImpl(env);
12 } 27 }
13 28
14 } // namespace base 29 } // namespace base
OLDNEW
« no previous file with comments | « base/system_monitor/system_monitor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698