chromium/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc

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

#include "chrome/browser/ui/views/download/bubble/download_bubble_row_view.h"

#include <string_view>
#include <utility>

#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/time/time.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/download/bubble/download_bubble_ui_controller.h"
#include "chrome/browser/download/download_item_warning_data.h"
#include "chrome/browser/download/download_stats.h"
#include "chrome/browser/download/download_ui_model.h"
#include "chrome/browser/download/drag_download_item.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/download/bubble/download_bubble_row_list_view.h"
#include "chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h"
#include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/grit/generated_resources.h"
#include "components/download/public/common/download_item.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/text/bytes_formatting.h"
#include "ui/color/color_id.h"
#include "ui/compositor/layer.h"
#include "ui/display/screen.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/image/image_util.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link_fragment.h"
#include "ui/views/controls/progress_bar.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/input_event_activation_protector.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_types.h"
#include "ui/views/layout/flex_layout_view.h"
#include "ui/views/layout/layout_manager.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/layout/table_layout.h"
#include "ui/views/rect_based_targeting_utils.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
#include "ui/views/vector_icons.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/view_targeter.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"

#if BUILDFLAG(IS_CHROMEOS)
#include "base/notreached.h"
#endif

namespace {

ui::ImageModel GetDefaultIcon() {}

gfx::Image GetDefaultIconImage(const ui::ColorProvider* color_provider) {}

constexpr int kDownloadButtonHeight =;
constexpr int kDownloadSubpageIconMargin =;
// Padding between elements in the row (except icon and label).
constexpr gfx::Insets kRowInterElementPadding =;
constexpr int kProgressBarHeight =;
// Num of columns in the table layout, the width of which progress bar will
// span. The 5 columns are Download Icon, Padding, Status text,
// Main Button, Subpage Icon.
constexpr int kNumColumns =;

// A stub subclass of Button that has no visuals.
class DownloadBubbleTransparentButton : public views::Button {};

BEGIN_METADATA()

#if !BUILDFLAG(IS_CHROMEOS)
class DownloadBubbleDeepScanNotice : public views::View {};

BEGIN_METADATA()
#endif

}  // namespace

void DownloadBubbleRowView::UpdateRow(bool initial_setup) {}

void DownloadBubbleRowView::AddedToWidget() {}

void DownloadBubbleRowView::RemovedFromWidget() {}

void DownloadBubbleRowView::OnDeviceScaleFactorChanged(
    float old_device_scale_factor,
    float new_device_scale_factor) {}

void DownloadBubbleRowView::SetIconFromImageModel(const ui::ImageModel& icon) {}

void DownloadBubbleRowView::SetIconFromImage(gfx::Image icon) {}

bool DownloadBubbleRowView::StartLoadFileIcon() {}

void DownloadBubbleRowView::OnFileIconLoaded(gfx::Image icon) {}

void DownloadBubbleRowView::SetFileIconAsIcon(bool is_default_icon) {}

void DownloadBubbleRowView::SetIcon() {}

DownloadBubbleRowView::~DownloadBubbleRowView() {}

DownloadBubbleRowView::DownloadBubbleRowView(
    const DownloadBubbleRowViewInfo& info,
    base::WeakPtr<DownloadBubbleUIController> bubble_controller,
    base::WeakPtr<DownloadBubbleNavigationHandler> navigation_handler,
    base::WeakPtr<Browser> browser,
    int fixed_width,
    bool is_in_partial_view)
    :{}

views::View::Views DownloadBubbleRowView::GetChildrenInZOrder() {}

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

void DownloadBubbleRowView::OnMouseEntered(const ui::MouseEvent& event) {}

void DownloadBubbleRowView::OnMouseExited(const ui::MouseEvent& event) {}

void DownloadBubbleRowView::OnMouseCaptureLost() {}

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

void DownloadBubbleRowView::AddLayerToRegion(ui::Layer* layer,
                                             views::LayerRegion region) {}

void DownloadBubbleRowView::RemoveLayerFromRegions(ui::Layer* layer) {}

void DownloadBubbleRowView::VisibilityChanged(views::View* starting_from,
                                              bool is_visible) {}

void DownloadBubbleRowView::OnWillChangeFocus(views::View* before,
                                              views::View* now) {}

void DownloadBubbleRowView::UpdateRowForHover(bool hovered) {}

void DownloadBubbleRowView::UpdateRowForFocus(
    bool visible,
    bool request_focus_on_last_quick_action) {}

void DownloadBubbleRowView::Layout(PassKey) {}

void DownloadBubbleRowView::OnMainButtonPressed(const ui::Event& event) {}

void DownloadBubbleRowView::OnActionButtonPressed(
    DownloadCommands::Command command,
    const ui::Event& event) {}

void DownloadBubbleRowView::UpdateButtons() {}

void DownloadBubbleRowView::UpdateProgressBar() {}

void DownloadBubbleRowView::UpdateLabels() {}

void DownloadBubbleRowView::UpdateDeepScanNotice() {}

void DownloadBubbleRowView::RecordMetricsOnUpdate() {}

void DownloadBubbleRowView::RecordDownloadDisplayed() {}

void DownloadBubbleRowView::AddMainPageButton(
    DownloadCommands::Command command,
    const std::u16string& button_string) {}

views::ImageButton* DownloadBubbleRowView::AddQuickAction(
    DownloadCommands::Command command) {}

views::ImageButton* DownloadBubbleRowView::GetActionButtonForCommand(
    DownloadCommands::Command command) {}

std::u16string DownloadBubbleRowView::GetAccessibleNameForQuickAction(
    DownloadCommands::Command command) {}

std::u16string DownloadBubbleRowView::GetAccessibleNameForMainPageButton(
    DownloadCommands::Command command) {}

void DownloadBubbleRowView::ShowContextMenuForViewImpl(
    View* source,
    const gfx::Point& point,
    ui::MenuSourceType source_type) {}

void DownloadBubbleRowView::UpdateStatusText() {}

bool DownloadBubbleRowView::AcceleratorPressed(
    const ui::Accelerator& accelerator) {}

bool DownloadBubbleRowView::CanHandleAccelerators() const {}

const std::u16string& DownloadBubbleRowView::GetSecondaryLabelTextForTesting() {}

void DownloadBubbleRowView::RegisterAccelerators(
    views::FocusManager* focus_manager) {}

void DownloadBubbleRowView::UnregisterAccelerators(
    views::FocusManager* focus_manager) {}

void DownloadBubbleRowView::OnInfoChanged() {}

void DownloadBubbleRowView::SimulateMainButtonClickForTesting(
    const ui::Event& event) {}

bool DownloadBubbleRowView::IsQuickActionButtonVisibleForTesting(
    DownloadCommands::Command command) {}

views::ImageButton* DownloadBubbleRowView::GetQuickActionButtonForTesting(
    DownloadCommands::Command command) {}

void DownloadBubbleRowView::SetInputProtectorForTesting(
    std::unique_ptr<views::InputEventActivationProtector> input_protector) {}

views::View* DownloadBubbleRowView::TargetForRect(View* root,
                                                  const gfx::Rect& rect) {}

BEGIN_METADATA()