refactor: migrate to View::AddChildView(std::unique_ptr<ui::View*>) (#46474)

* refactor: use AddChildView(std::unique_ptr<View>) in OpaqueFrameView::CreateButton()

Xref: https://issues.chromium.org/issues/40485510

* refactor: use AddChildView(std::unique_ptr<View>) in MenuBar::RebuildChildren()

* refactor: use AddChildView(std::unique_ptr<View>) for ClientFrameViewLinux labels

* refactor: use AddChildView(std::unique_ptr<View>) for ClientFrameViewLinux buttons

* refactor: use AddChildView(std::unique_ptr<View>) in AutofillPopupView

* refactor: use AddChildViewRaw() to flag the edge cases that we still need to fix

* chore: use west coast const for consistency
This commit is contained in:
Charles Kerr 2025-04-07 09:20:46 -05:00 committed by GitHub
parent a6875c732c
commit 85dce12be3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 30 additions and 32 deletions

View file

@ -297,7 +297,7 @@ views::Button* OpaqueFrameView::CreateButton(
int ht_component,
const gfx::VectorIcon& icon_image,
views::Button::PressedCallback callback) {
views::FrameCaptionButton* button = new views::FrameCaptionButton(
auto button = std::make_unique<views::FrameCaptionButton>(
views::Button::PressedCallback(), icon_type, ht_component);
button->SetImage(button->GetIcon(), views::FrameCaptionButton::Animate::kNo,
icon_image);
@ -306,12 +306,11 @@ views::Button* OpaqueFrameView::CreateButton(
button->SetCallback(std::move(callback));
button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id));
button->SetID(view_id);
AddChildView(button);
button->SetPaintToLayer();
button->layer()->SetFillsBoundsOpaquely(false);
return button;
return AddChildView(std::move(button));
}
gfx::Insets OpaqueFrameView::FrameBorderInsets(bool restored) const {