media_notification_view.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2019 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_NOTIFICATION_VIEW_H_
  5. #define COMPONENTS_MEDIA_MESSAGE_CENTER_MEDIA_NOTIFICATION_VIEW_H_
  6. #include "base/containers/flat_set.h"
  7. #include "services/media_session/public/mojom/media_session.mojom.h"
  8. #include "ui/views/view.h"
  9. namespace gfx {
  10. class ImageSkia;
  11. struct VectorIcon;
  12. } // namespace gfx
  13. namespace media_session {
  14. struct MediaMetadata;
  15. } // namespace media_session
  16. namespace media_message_center {
  17. // MediaNotificationView will show up as a custom view. It will show the
  18. // currently playing media and provide playback controls.
  19. class COMPONENT_EXPORT(MEDIA_MESSAGE_CENTER) MediaNotificationView
  20. : public views::View {
  21. public:
  22. // When |forced_expanded_state| has a value, the notification will be forced
  23. // into that expanded state and the user won't be given a button to toggle the
  24. // expanded state. Subsequent |SetExpanded()| calls will be ignored until
  25. // |SetForcedExpandedState(nullptr)| is called.
  26. virtual void SetForcedExpandedState(bool* forced_expanded_state) = 0;
  27. virtual void SetExpanded(bool expanded) = 0;
  28. virtual void UpdateCornerRadius(int top_radius, int bottom_radius) = 0;
  29. virtual void UpdateWithMediaSessionInfo(
  30. const media_session::mojom::MediaSessionInfoPtr& session_info) = 0;
  31. virtual void UpdateWithMediaMetadata(
  32. const media_session::MediaMetadata& metadata) = 0;
  33. virtual void UpdateWithMediaActions(
  34. const base::flat_set<media_session::mojom::MediaSessionAction>&
  35. actions) = 0;
  36. virtual void UpdateWithMediaPosition(
  37. const media_session::MediaPosition& position) = 0;
  38. virtual void UpdateWithMediaArtwork(const gfx::ImageSkia& image) = 0;
  39. // Updates the background color to match that of the favicon.
  40. virtual void UpdateWithFavicon(const gfx::ImageSkia& icon) = 0;
  41. // Sets the icon to be displayed in the notification's header section.
  42. // |vector_icon| must outlive the MediaNotificationView.
  43. virtual void UpdateWithVectorIcon(const gfx::VectorIcon& vector_icon) = 0;
  44. virtual void UpdateDeviceSelectorAvailability(bool availability) = 0;
  45. // Called by MediaNotificationItem to update mute state.
  46. virtual void UpdateWithMuteStatus(bool mute) = 0;
  47. // Called by MediaNotificationitem to update volume.
  48. virtual void UpdateWithVolume(float volume) = 0;
  49. };
  50. } // namespace media_message_center
  51. #endif // COMPONENTS_MEDIA_MESSAGE_CENTER_MEDIA_NOTIFICATION_VIEW_H_