capture_mode_ash_notification_view.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 ASH_CAPTURE_MODE_CAPTURE_MODE_ASH_NOTIFICATION_VIEW_H_
  5. #define ASH_CAPTURE_MODE_CAPTURE_MODE_ASH_NOTIFICATION_VIEW_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/capture_mode/capture_mode_types.h"
  8. #include "ash/system/message_center/ash_notification_view.h"
  9. namespace message_center {
  10. class MessageView;
  11. class Notification;
  12. } // namespace message_center
  13. namespace views {
  14. class View;
  15. } // namespace views
  16. namespace ash {
  17. // A customized notification view for capture mode that adjusts the capture
  18. // notification by either showing a banner on top of the notification image for
  19. // image captures, or a play icon on top of the video thumbnail.
  20. class ASH_EXPORT CaptureModeAshNotificationView : public AshNotificationView {
  21. public:
  22. CaptureModeAshNotificationView(
  23. const message_center::Notification& notification,
  24. CaptureModeType capture_type,
  25. bool shown_in_popup);
  26. CaptureModeAshNotificationView(const CaptureModeAshNotificationView&) =
  27. delete;
  28. CaptureModeAshNotificationView& operator=(
  29. const CaptureModeAshNotificationView&) = delete;
  30. ~CaptureModeAshNotificationView() override;
  31. // Creates the custom capture mode notification for image capture
  32. // notifications. There is a banner on top of the image area of the
  33. // notification to indicate the image has been copied to clipboard.
  34. static std::unique_ptr<message_center::MessageView> CreateForImage(
  35. const message_center::Notification& notification,
  36. bool shown_in_popup);
  37. // Creates the custom capture mode notification for video capture
  38. // notifications. There is a superimposed "play" icon on top of the video
  39. // thumbnail image.
  40. static std::unique_ptr<message_center::MessageView> CreateForVideo(
  41. const message_center::Notification& notification,
  42. bool shown_in_popup);
  43. // AshNotificationView:
  44. void UpdateWithNotification(
  45. const message_center::Notification& notification) override;
  46. void Layout() override;
  47. private:
  48. void CreateExtraView();
  49. // The type of capture this notification was created for.
  50. const CaptureModeType capture_type_;
  51. // The extra view created on top of the notification image. This will be a
  52. // banner clarifying that the image was copied to the clipboard in case of
  53. // image capture, or a superimposed "play" icon on top of the video thumbnail
  54. // image.
  55. // Owned by the view hierarchy.
  56. views::View* extra_view_ = nullptr;
  57. };
  58. } // namespace ash
  59. #endif // ASH_CAPTURE_MODE_CAPTURE_MODE_ASH_NOTIFICATION_VIEW_H_