| Index: ash/common/system/chromeos/power/power_status.h
|
| diff --git a/ash/common/system/chromeos/power/power_status.h b/ash/common/system/chromeos/power/power_status.h
|
| index 90d06fff1e2ce62d65695fc8d09b63d9a805222e..f94c740b2603ead9faea90b21e0fb67b6616ea44 100644
|
| --- a/ash/common/system/chromeos/power/power_status.h
|
| +++ b/ash/common/system/chromeos/power/power_status.h
|
| @@ -17,6 +17,10 @@
|
| #include "chromeos/dbus/power_manager_client.h"
|
| #include "ui/gfx/image/image_skia.h"
|
|
|
| +namespace gfx {
|
| +struct VectorIcon;
|
| +}
|
| +
|
| namespace ash {
|
|
|
| // PowerStatus is a singleton that receives updates about the system's
|
| @@ -24,15 +28,6 @@ namespace ash {
|
| // available to interested classes within Ash.
|
| class ASH_EXPORT PowerStatus : public chromeos::PowerManagerClient::Observer {
|
| public:
|
| - // Types of badges which can be drawn on top of a battery icon.
|
| - enum IconBadge {
|
| - ICON_BADGE_NONE,
|
| - ICON_BADGE_ALERT,
|
| - ICON_BADGE_BOLT,
|
| - ICON_BADGE_X,
|
| - ICON_BADGE_UNRELIABLE
|
| - };
|
| -
|
| // Different styles of battery icons.
|
| enum IconSet { ICON_LIGHT, ICON_DARK };
|
|
|
| @@ -73,39 +68,18 @@ class ASH_EXPORT PowerStatus : public chromeos::PowerManagerClient::Observer {
|
| // updating onscreen icons (GetBatteryImage() creates a new image on each
|
| // call).
|
| struct BatteryImageInfo {
|
| - BatteryImageInfo()
|
| - : resource_id(-1),
|
| - offset(-1),
|
| - index(-1),
|
| - icon_badge(ICON_BADGE_NONE),
|
| - charge_level(-1) {}
|
| + BatteryImageInfo() : icon_badge(nullptr), charge_level(-1) {}
|
|
|
| bool operator==(const BatteryImageInfo& o) const;
|
|
|
| bool operator!=(const BatteryImageInfo& o) const { return !(*this == o); }
|
|
|
| - // Resource ID of the image containing the specific battery icon to use.
|
| - // Only used in non-MD.
|
| - int resource_id;
|
| -
|
| - // Horizontal offset in the battery icon array image. The USB / "unreliable
|
| - // charging" image has a single column of icons; the other image contains a
|
| - // "battery" column on the left and a "line power" column on the right.
|
| - // Only used in non-MD.
|
| - int offset;
|
| -
|
| - // Vertical offset corresponding to the current battery level. Only used in
|
| - // non-MD.
|
| - int index;
|
| -
|
| // The badge (lightning bolt, exclamation mark, etc) that should be drawn
|
| - // on top of the battery icon. Only used for MD.
|
| - // TODO(tdanderson): Consider using gfx::VectorIconId instead of this enum
|
| - // once all possible badges have been vectorized. See crbug.com/617298.
|
| - IconBadge icon_badge;
|
| + // on top of the battery icon.
|
| + const gfx::VectorIcon* icon_badge;
|
|
|
| - // A value between 0 and kBatteryImageHeightMD representing the height
|
| - // of the battery's charge level in dp. Only used for MD.
|
| + // A value between 0 and kBatteryImageHeight representing the height
|
| + // of the battery's charge level in dp.
|
| int charge_level;
|
| };
|
|
|
| @@ -114,10 +88,10 @@ class ASH_EXPORT PowerStatus : public chromeos::PowerManagerClient::Observer {
|
| // get very large; avoid displaying these large numbers.
|
| static const int kMaxBatteryTimeToDisplaySec;
|
|
|
| - // An alert badge is drawn over the material design battery icon if the
|
| - // battery is not connected to a charger and has less than
|
| - // |kCriticalBatteryChargePercentageMd| percentage of charge remaining.
|
| - static const double kCriticalBatteryChargePercentageMd;
|
| + // An alert badge is drawn over the battery icon if the battery is not
|
| + // connected to a charger and has less than |kCriticalBatteryChargePercentage|
|
| + // percentage of charge remaining.
|
| + static const double kCriticalBatteryChargePercentage;
|
|
|
| // Sets the global instance. Must be called before any calls to Get().
|
| static void Initialize();
|
| @@ -220,24 +194,13 @@ class ASH_EXPORT PowerStatus : public chromeos::PowerManagerClient::Observer {
|
| // returned by this method to avoid creating new images unnecessarily.
|
| BatteryImageInfo GetBatteryImageInfo(IconSet icon_set) const;
|
|
|
| - // A helper function called by GetBatteryImageInfo(). Populates the
|
| - // MD-specific fields of |info|.
|
| - void CalculateBatteryImageInfoMd(BatteryImageInfo* info) const;
|
| -
|
| - // A helper function called by GetBatteryImageInfo(). Populates the
|
| - // non-MD-specific fields of |info|.
|
| - void CalculateBatteryImageInfoNonMd(BatteryImageInfo* info,
|
| - const IconSet& icon_set) const;
|
| + // A helper function called by GetBatteryImageInfo(). Populates the fields of
|
| + // |info|.
|
| + void CalculateBatteryImageInfo(BatteryImageInfo* info) const;
|
|
|
| // Creates a new image that should be shown for the battery's current state.
|
| gfx::ImageSkia GetBatteryImage(const BatteryImageInfo& info) const;
|
|
|
| - // A version of GetBatteryImage() that is used when material design is not
|
| - // enabled.
|
| - // TODO(tdanderson): Remove this once material design is enabled by default.
|
| - // See crbug.com/614453.
|
| - gfx::ImageSkia GetBatteryImageNonMd(const BatteryImageInfo& info) const;
|
| -
|
| // Returns an string describing the current state for accessibility.
|
| base::string16 GetAccessibleNameString(bool full_description) const;
|
|
|
|
|