#include "ash/system/unified/glanceable_tray_child_bubble.h"
#include <memory>
#include "ash/public/cpp/style/color_provider.h"
#include "base/functional/bind.h"
#include "base/types/cxx23_to_underlying.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
#include "ui/compositor/layer.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/highlight_border.h"
#include "ui/views/view_class_properties.h"
namespace ash {
namespace {
constexpr int kBubbleCornerRadius = 24;
}
GlanceableTrayChildBubble::GlanceableTrayChildBubble(
bool use_glanceables_container_style) {
if (use_glanceables_container_style) {
GetViewAccessibility().SetRole(ax::mojom::Role::kGroup);
SetPaintToLayer();
layer()->SetIsFastRoundedCorner(true);
layer()->SetRoundedCornerRadius(
gfx::RoundedCornersF{static_cast<float>(kBubbleCornerRadius)});
if (chromeos::features::IsSystemBlurEnabled()) {
layer()->SetFillsBoundsOpaquely(false);
layer()->SetBackgroundBlur(ColorProvider::kBackgroundBlurSigma);
layer()->SetBackdropFilterQuality(ColorProvider::kBackgroundBlurQuality);
}
const ui::ColorId background_color_id =
chromeos::features::IsSystemBlurEnabled()
? cros_tokens::kCrosSysSystemBaseElevated
: cros_tokens::kCrosSysSystemBaseElevatedOpaque;
SetBackground(views::CreateSolidBackground(background_color_id));
SetBorder(std::make_unique<views::HighlightBorder>(
kBubbleCornerRadius,
views::HighlightBorder::Type::kHighlightBorderOnShadow));
}
}
BEGIN_METADATA(GlanceableTrayChildBubble)
END_METADATA
}