chromium/chrome/browser/ui/views/autofill/popup/popup_row_with_button_view.cc

// 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.

#include "chrome/browser/ui/views/autofill/popup/popup_row_with_button_view.h"

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#include "chrome/browser/ui/views/autofill/popup/popup_row_content_view.h"
#include "chrome/browser/ui/views/autofill/popup/popup_row_view.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "components/input/native_web_keyboard_event.h"
#include "components/strings/grit/components_strings.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"

namespace autofill {

namespace {

// Overrides `OnMouseEntered` and `OnMouseExited` from
// `views::ButtonController`. Used by `PopupRowWithButtonView` to know when
// the mouse cursor has entered or left the delete button in order to run the
// selection callbacks.
class ButtonController : public views::ButtonController {};

// Used to determine when both the placeholder and the button are painted
// and have dimensions. This is important to solve the issue where deleting an
// entry leads to another entry being rendered right under the cursor.
class ButtonPlaceholder : public views::View, public views::ViewObserver {};

ButtonPlaceholder::ButtonPlaceholder(ButtonDelegate* button_delegate)
    :{}

ButtonPlaceholder::~ButtonPlaceholder() = default;

void ButtonPlaceholder::OnPaint(gfx::Canvas* canvas) {}

void ButtonPlaceholder::OnViewBoundsChanged(View* observed_view) {}

BEGIN_METADATA()

}  // namespace

PopupRowWithButtonView::PopupRowWithButtonView(
    AccessibilitySelectionDelegate& a11y_selection_delegate,
    SelectionDelegate& selection_delegate,
    base::WeakPtr<AutofillPopupController> controller,
    int line_number,
    std::unique_ptr<PopupRowContentView> content_view,
    std::unique_ptr<views::ImageButton> button,
    ButtonBehavior button_behavior)
    :{}

PopupRowWithButtonView::~PopupRowWithButtonView() = default;

views::View* PopupRowWithButtonView::GetButtonContainer() {}

void PopupRowWithButtonView::HandleKeyPressEventFocusOnButton() {}

void PopupRowWithButtonView::HandleKeyPressEventFocusOnContent() {}

bool PopupRowWithButtonView::HandleKeyPressEvent(
    const input::NativeWebKeyboardEvent& event) {}

void PopupRowWithButtonView::SetSelectedCell(std::optional<CellType> cell) {}

void PopupRowWithButtonView::OnMouseEnteredButton() {}

void PopupRowWithButtonView::OnMouseExitedButton() {}

void PopupRowWithButtonView::UpdateFocusedPartAndSelectedSuggestion(
    std::optional<RowWithButtonPart> part) {}

bool PopupRowWithButtonView::ShouldButtonBeVisible() const {}

BEGIN_METADATA()

}  // namespace autofill