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

Unified Diff: chromeos/dbus/fake_power_manager_client.h

Issue 1206733002: ChromeOs Power Emulation Impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added local namespace for constants Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_power_manager_client.h
diff --git a/chromeos/dbus/fake_power_manager_client.h b/chromeos/dbus/fake_power_manager_client.h
index d6cd0429f975b899ec2a64fc8f8158dce391a83d..4ca1d9ce11c6a5004cf5eae1b797f3d00f05552f 100644
--- a/chromeos/dbus/fake_power_manager_client.h
+++ b/chromeos/dbus/fake_power_manager_client.h
@@ -7,10 +7,9 @@
#include <string>
-#include "base/basictypes.h"
-#include "base/macros.h"
#include "base/observer_list.h"
#include "chromeos/dbus/power_manager/policy.pb.h"
+#include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
#include "chromeos/dbus/power_manager/suspend.pb.h"
#include "chromeos/dbus/power_manager_client.h"
@@ -67,6 +66,17 @@ class FakePowerManagerClient : public PowerManagerClient {
// Notifies observers that the power button has been pressed or released.
void SendPowerButtonEvent(bool down, const base::TimeTicks& timestamp);
+ // Emulates the changes in various power settings.
+ void UpdateBatteryPercentage(int percentage);
+ void UpdateBatteryFullTimeToEmpty(int time_in_hours);
+ void UpdateExternalPower(int external_power);
+ void UpdateIsBatteryCharging(bool is_charging);
+ void UpdateIsCalculatingBatteryTime(bool is_calculating);
+
+ // Called once any power states are changed to notify the observer of the
+ // change.
+ void UpdatePowerStatus();
+
private:
// Callback that will be run by asynchronous suspend delays to report
// readiness.
@@ -77,6 +87,16 @@ class FakePowerManagerClient : public PowerManagerClient {
// Last policy passed to SetPolicy().
power_manager::PowerManagementPolicy policy_;
+ // The power properties set for for the UI.
+ power_manager::PowerSupplyProperties props_;
+
+ // Variables that handle states of the battery and power.
+ bool is_charging_;
+ bool is_calculating_;
+ int battery_percentage_;
+ int power_source_;
+ int hours_to_empty_full_battery_;
+
// Number of times that various methods have been called.
int num_request_restart_calls_;
int num_request_shutdown_calls_;
@@ -92,6 +112,10 @@ class FakePowerManagerClient : public PowerManagerClient {
// Delegate for managing power consumption of Chrome's renderer processes.
base::WeakPtr<RenderProcessManagerDelegate> render_process_manager_delegate_;
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate its weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<FakePowerManagerClient> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient);
};
« no previous file with comments | « no previous file | chromeos/dbus/fake_power_manager_client.cc » ('j') | chromeos/dbus/fake_power_manager_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698