media_artwork_view.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2021 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 COMPONENTS_MEDIA_MESSAGE_CENTER_MEDIA_ARTWORK_VIEW_H_
  5. #define COMPONENTS_MEDIA_MESSAGE_CENTER_MEDIA_ARTWORK_VIEW_H_
  6. #include "ui/base/metadata/metadata_header_macros.h"
  7. #include "ui/base/metadata/metadata_impl_macros.h"
  8. #include "ui/gfx/color_palette.h"
  9. #include "ui/views/view.h"
  10. namespace media_message_center {
  11. // An artwork view with a rounded rectangle vignette
  12. class MediaArtworkView : public views::View {
  13. public:
  14. METADATA_HEADER(MediaArtworkView);
  15. MediaArtworkView(float corner_radius,
  16. const gfx::Size& artwork_size,
  17. const gfx::Size& favicon_size);
  18. ~MediaArtworkView() override = default;
  19. void SetVignetteColor(const SkColor& vignette_color);
  20. SkColor GetVignetteColor() const;
  21. void SetBackgroundColor(const SkColor& background_color);
  22. void SetImage(const gfx::ImageSkia& image);
  23. void SetFavicon(const gfx::ImageSkia& favicon);
  24. // views::View
  25. void OnPaint(gfx::Canvas* canvas) override;
  26. private:
  27. SkColor vignette_color_ = gfx::kPlaceholderColor;
  28. SkColor background_color_ = gfx::kPlaceholderColor;
  29. gfx::ImageSkia image_;
  30. gfx::ImageSkia favicon_;
  31. const float corner_radius_;
  32. const gfx::Size artwork_size_;
  33. const gfx::Size favicon_size_;
  34. };
  35. } // namespace media_message_center
  36. #endif // COMPONENTS_MEDIA_MESSAGE_CENTER_MEDIA_ARTWORK_VIEW_H_