battery_image_source.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2020 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.
  4. #ifndef ASH_SYSTEM_POWER_BATTERY_IMAGE_SOURCE_H_
  5. #define ASH_SYSTEM_POWER_BATTERY_IMAGE_SOURCE_H_
  6. #include "ash/system/power/power_status.h"
  7. #include "ui/gfx/image/canvas_image_source.h"
  8. namespace ash {
  9. // ImageSource for the battery icon, used in system tray and network detailed
  10. // page.
  11. class ASH_EXPORT BatteryImageSource : public gfx::CanvasImageSource {
  12. public:
  13. BatteryImageSource(const PowerStatus::BatteryImageInfo& info,
  14. int height,
  15. SkColor bg_color,
  16. SkColor fg_color,
  17. absl::optional<SkColor> badge_color);
  18. BatteryImageSource(BatteryImageSource&) = delete;
  19. BatteryImageSource operator=(BatteryImageSource&) = delete;
  20. ~BatteryImageSource() override;
  21. // gfx::ImageSkiaSource implementation.
  22. void Draw(gfx::Canvas* canvas) override;
  23. bool HasRepresentationAtAllScales() const override;
  24. private:
  25. PowerStatus::BatteryImageInfo info_;
  26. const SkColor bg_color_;
  27. const SkColor fg_color_;
  28. const SkColor badge_color_;
  29. };
  30. } // namespace ash
  31. #endif // ASH_SYSTEM_POWER_BATTERY_IMAGE_SOURCE_H_