Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / battery_status / battery_status_manager_android.h
blobd6d3e2ed9b222735276366aedff0d723dc21f8a8
1 // Copyright 2014 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/android/scoped_java_ref.h"
6 #include "base/macros.h"
7 #include "content/browser/battery_status/battery_status_manager.h"
9 #ifndef CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_ANDROID_H_
10 #define CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_ANDROID_H_
12 namespace content {
14 class BatteryStatusManagerAndroid : public BatteryStatusManager {
15 public:
16 explicit BatteryStatusManagerAndroid(
17 const BatteryStatusService::BatteryUpdateCallback& callback);
18 virtual ~BatteryStatusManagerAndroid();
20 // Must be called at startup.
21 static bool Register(JNIEnv* env);
23 // Called from Java via JNI.
24 void GotBatteryStatus(JNIEnv*,
25 jobject,
26 jboolean charging,
27 jdouble charging_time,
28 jdouble discharging_time,
29 jdouble level);
31 private:
32 // BatteryStatusManager:
33 virtual bool StartListeningBatteryChange() OVERRIDE;
34 virtual void StopListeningBatteryChange() OVERRIDE;
36 BatteryStatusService::BatteryUpdateCallback callback_;
37 // Java provider of battery status info.
38 base::android::ScopedJavaGlobalRef<jobject> j_manager_;
40 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerAndroid);
43 } // namespace content
45 #endif // CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_ANDROID_H_