1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62

ash / scalable_iph / wallpaper_ash_notification_view.h [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SCALABLE_IPH_WALLPAPER_ASH_NOTIFICATION_VIEW_H_
#define ASH_SCALABLE_IPH_WALLPAPER_ASH_NOTIFICATION_VIEW_H_

#include "ash/ash_export.h"
#include "ash/scalable_iph/scalable_iph_ash_notification_view.h"
#include "base/memory/raw_ptr.h"

namespace message_center {
class MessageView;
class Notification;
}  // namespace message_center

namespace views {
class View;
}  // namespace views

namespace ash {

class RoundedImageView;

// A customized notification view for scalable IPH that adjusts the notification
// by showing four preview images for wallpaper.
class ASH_EXPORT WallpaperAshNotificationView
    : public ScalableIphAshNotificationView {
  METADATA_HEADER(WallpaperAshNotificationView, ScalableIphAshNotificationView)

 public:
  WallpaperAshNotificationView(const message_center::Notification& notification,
                               bool shown_in_popup);
  WallpaperAshNotificationView(const WallpaperAshNotificationView&) = delete;
  WallpaperAshNotificationView& operator=(const WallpaperAshNotificationView&) =
      delete;
  ~WallpaperAshNotificationView() override;

  // Creates the custom notification with wallpaper preview images.
  static std::unique_ptr<message_center::MessageView> CreateWithPreview(
      const message_center::Notification& notification,
      bool shown_in_popup);

  // AshNotificationView:
  void UpdateWithNotification(
      const message_center::Notification& notification) override;

 private:
  friend class WallpaperAshNotificationViewTest;

  void CreatePreview();

  // The preview view created to replace the notification image.
  // Owned by the view hierarchy.
  raw_ptr<views::View> preview_ = nullptr;
  std::vector<raw_ptr<RoundedImageView, VectorExperimental>> image_views_{
      4, nullptr};
};

}  // namespace ash

#endif  // ASH_SCALABLE_IPH_WALLPAPER_ASH_NOTIFICATION_VIEW_H_