Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / battery_status / battery_status_manager_android.h
blob04746de61b1f1cb20c5c938a0c38c32ab4972b26
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 #ifndef CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_ANDROID_H_
6 #define CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_ANDROID_H_
8 #include "base/android/scoped_java_ref.h"
9 #include "content/common/content_export.h"
11 namespace content {
13 // Android implementation of Battery Status API.
14 class CONTENT_EXPORT BatteryStatusManagerAndroid {
15 public:
16 // Must be called at startup.
17 static bool Register(JNIEnv* env);
19 // Called from Java via JNI.
20 void GotBatteryStatus(JNIEnv*, jobject, jboolean charging,
21 jdouble chargingTime, jdouble dischargingTime,
22 jdouble level);
24 bool StartListeningBatteryChange();
25 void StopListeningBatteryChange();
27 protected:
28 BatteryStatusManagerAndroid();
29 virtual ~BatteryStatusManagerAndroid();
31 private:
32 // Java provider of battery status info.
33 base::android::ScopedJavaGlobalRef<jobject> j_manager_;
35 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerAndroid);
38 } // namespace content
40 #endif // CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_ANDROID_H_