chromium/ui/message_center/views/notification_view_base.cc

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

#include "ui/message_center/views/notification_view_base.h"

#include <stddef.h>

#include <algorithm>
#include <memory>
#include <utility>

#include "ash/constants/ash_features.h"
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/i18n/case_conversion.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h"
#include "base/strings/string_util.h"
#include "build/chromeos_buildflags.h"
#include "components/url_formatter/elide_url.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/base/class_property.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/text_constants.h"
#include "ui/gfx/text_elider.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/notification_list.h"
#include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_types.h"
#include "ui/message_center/vector_icons.h"
#include "ui/message_center/views/large_image_view.h"
#include "ui/message_center/views/notification_control_buttons_view.h"
#include "ui/message_center/views/notification_header_view.h"
#include "ui/message_center/views/proportional_image_view.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/focus_ring.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/progress_bar.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/style/typography.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"

namespace message_center {

namespace {

// Dimensions.
constexpr int kActionsRowHorizontalSpacing =;
constexpr auto kStatusTextPadding =;
constexpr gfx::Insets kActionsRowPadding(8);
constexpr int kLargeImageMaxHeight =;

constexpr int kCompactTitleMessageViewSpacing =;

constexpr int kProgressBarHeight =;

// In progress notification, if both the title and the message are long, the
// message would be prioritized and the title would be elided.
// However, it is not preferable that we completely omit the title, so
// the ratio of the message width is limited to this value.
constexpr double kProgressNotificationMessageRatio =;

// Creates a view responsible for drawing each list notification item's title
// and message next to each other within a single column.
std::unique_ptr<views::View> CreateItemView(const NotificationItem& item) {}

bool IsForAshNotification() {}

}  // anonymous namespace

// CompactTitleMessageView /////////////////////////////////////////////////////

CompactTitleMessageView::~CompactTitleMessageView() = default;

CompactTitleMessageView::CompactTitleMessageView() {}

gfx::Size CompactTitleMessageView::CalculatePreferredSize(
    const views::SizeBounds& /*available_size*/) const {}

views::ProposedLayout CompactTitleMessageView::CalculateProposedLayout(
    const views::SizeBounds& size_bounds) const {}

void CompactTitleMessageView::set_title(const std::u16string& title) {}

void CompactTitleMessageView::set_message(const std::u16string& message) {}

BEGIN_METADATA()

// ////////////////////////////////////////////////////////////
// NotificationViewBase
// ////////////////////////////////////////////////////////////

void NotificationViewBase::CreateOrUpdateViews(
    const Notification& notification) {}

NotificationViewBase::NotificationViewBase(const Notification& notification)
    :{}

NotificationViewBase::~NotificationViewBase() = default;

void NotificationViewBase::OnFocus() {}

bool NotificationViewBase::OnMousePressed(const ui::MouseEvent& event) {}

bool NotificationViewBase::OnMouseDragged(const ui::MouseEvent& event) {}

void NotificationViewBase::OnMouseReleased(const ui::MouseEvent& event) {}

void NotificationViewBase::OnGestureEvent(ui::GestureEvent* event) {}

void NotificationViewBase::UpdateWithNotification(
    const Notification& notification) {}

void NotificationViewBase::OnNotificationInputSubmit(
    size_t index,
    const std::u16string& text) {}

bool NotificationViewBase::IsIconViewShown() const {}

views::Builder<NotificationControlButtonsView>
NotificationViewBase::CreateControlButtonsBuilder() {}

views::Builder<NotificationHeaderView>
NotificationViewBase::CreateHeaderRowBuilder() {}

views::Builder<views::BoxLayoutView>
NotificationViewBase::CreateLeftContentBuilder() {}

views::Builder<views::View> NotificationViewBase::CreateRightContentBuilder() {}

views::Builder<views::View> NotificationViewBase::CreateContentRowBuilder() {}

views::Builder<views::BoxLayoutView>
NotificationViewBase::CreateInlineSettingsBuilder() {}

views::Builder<views::BoxLayoutView>
NotificationViewBase::CreateSnoozeSettingsBuilder() {}

views::Builder<views::View>
NotificationViewBase::CreateImageContainerBuilder() {}

std::unique_ptr<views::View> NotificationViewBase::CreateActionsRow(
    std::unique_ptr<views::LayoutManager> layout_manager) {}

// static
std::unique_ptr<views::Label> NotificationViewBase::GenerateTitleView(
    const std::u16string& title) {}

std::unique_ptr<NotificationInputContainer>
NotificationViewBase::GenerateNotificationInputContainer() {}

void NotificationViewBase::CreateOrUpdateHeaderView(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateCompactTitleMessageView(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateProgressBarView(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateProgressStatusView(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateMessageLabel(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateProgressViews(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateListItemViews(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateIconView(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateImageView(
    const Notification& notification) {}

void NotificationViewBase::CreateOrUpdateActionButtonViews(
    const Notification& notification) {}

void NotificationViewBase::ReorderViewInLeftContent(views::View* view) {}

void NotificationViewBase::ActionButtonPressed(size_t index,
                                               const ui::Event& event) {}

void NotificationViewBase::OnInlineReplyUpdated() {}

bool NotificationViewBase::HasInlineReply(
    const Notification& notification) const {}

void NotificationViewBase::SetExpandButtonVisibility(bool enabled) {}

void NotificationViewBase::UpdateViewForExpandedState(bool expanded) {}

NotificationControlButtonsView* NotificationViewBase::GetControlButtonsView()
    const {}

bool NotificationViewBase::IsExpanded() const {}

void NotificationViewBase::SetExpanded(bool expanded) {}

bool NotificationViewBase::IsManuallyExpandedOrCollapsed() const {}

void NotificationViewBase::SetManuallyExpandedOrCollapsed(ExpandState state) {}

void NotificationViewBase::ToggleInlineSettings(const ui::Event& event) {}

void NotificationViewBase::ToggleSnoozeSettings(const ui::Event& event) {}

void NotificationViewBase::InkDropAnimationStarted() {}

void NotificationViewBase::InkDropRippleAnimationEnded(
    views::InkDropState ink_drop_state) {}

BEGIN_METADATA()

}  // namespace message_center