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

Side by Side Diff: power_monitor/power_monitor_device_source_android.cc

Issue 2050803003: Update to Chromium //base at Chromium commit e3a753f17bac62738b0dbf0b36510f767b081e4b. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pickle_unittest.cc ('k') | process/kill.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/power_monitor/power_monitor_device_source_android.h" 5 #include "base/power_monitor/power_monitor_device_source_android.h"
6 6
7 #include "base/power_monitor/power_monitor.h" 7 #include "base/power_monitor/power_monitor.h"
8 #include "base/power_monitor/power_monitor_device_source.h" 8 #include "base/power_monitor/power_monitor_device_source.h"
9 #include "base/power_monitor/power_monitor_source.h" 9 #include "base/power_monitor/power_monitor_source.h"
10 #include "jni/PowerMonitor_jni.h" 10 #include "jni/PowerMonitor_jni.h"
11 11
12 namespace base { 12 namespace base {
13 13
14 // A helper function which is a friend of PowerMonitorSource. 14 // A helper function which is a friend of PowerMonitorSource.
15 void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) { 15 void ProcessPowerEventHelper(PowerMonitorSource::PowerEvent event) {
16 PowerMonitorSource::ProcessPowerEvent(event); 16 PowerMonitorSource::ProcessPowerEvent(event);
17 } 17 }
18 18
19 namespace android { 19 namespace android {
20 20
21 // Native implementation of PowerMonitor.java. 21 // Native implementation of PowerMonitor.java.
22 void OnBatteryChargingChanged(JNIEnv* env, jclass clazz) { 22 void OnBatteryChargingChanged(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
23 ProcessPowerEventHelper(PowerMonitorSource::POWER_STATE_EVENT); 23 ProcessPowerEventHelper(PowerMonitorSource::POWER_STATE_EVENT);
24 } 24 }
25 25
26 void OnMainActivityResumed(JNIEnv* env, jclass clazz) { 26 void OnMainActivityResumed(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
27 ProcessPowerEventHelper(PowerMonitorSource::RESUME_EVENT); 27 ProcessPowerEventHelper(PowerMonitorSource::RESUME_EVENT);
28 } 28 }
29 29
30 void OnMainActivitySuspended(JNIEnv* env, jclass clazz) { 30 void OnMainActivitySuspended(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
31 ProcessPowerEventHelper(PowerMonitorSource::SUSPEND_EVENT); 31 ProcessPowerEventHelper(PowerMonitorSource::SUSPEND_EVENT);
32 } 32 }
33 33
34 } // namespace android 34 } // namespace android
35 35
36 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { 36 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
37 JNIEnv* env = base::android::AttachCurrentThread(); 37 JNIEnv* env = base::android::AttachCurrentThread();
38 return base::android::Java_PowerMonitor_isBatteryPower(env); 38 return base::android::Java_PowerMonitor_isBatteryPower(env);
39 } 39 }
40 40
41 bool RegisterPowerMonitor(JNIEnv* env) { 41 bool RegisterPowerMonitor(JNIEnv* env) {
42 return base::android::RegisterNativesImpl(env); 42 return base::android::RegisterNativesImpl(env);
43 } 43 }
44 44
45 } // namespace base 45 } // namespace base
OLDNEW
« no previous file with comments | « pickle_unittest.cc ('k') | process/kill.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698