Commit 63daa32a authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: remove TabHoverCardBubbleView CreateFootnoteView

This one is easy: TabHoverCardBubbleView recreates its footnote view whenever
the footnote view's state changes anyway, so simply don't create it in the
constructor at all.

Bug: 1011446
Change-Id: Ia195f28d48dd3a76897c3f466476aaf78a8c13bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910422Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714482}
parent 799dc281
......@@ -97,6 +97,16 @@ bool CustomShadowsSupported() {
#endif
}
std::unique_ptr<views::View> CreateAlertView(const TabAlertState& state) {
auto alert_state_label = std::make_unique<views::Label>(
base::string16(), CONTEXT_BODY_TEXT_LARGE, views::style::STYLE_PRIMARY);
alert_state_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
alert_state_label->SetMultiLine(true);
alert_state_label->SetVisible(true);
alert_state_label->SetText(chrome::GetTabAlertStateText(state));
return alert_state_label;
}
} // namespace
// static
......@@ -635,19 +645,6 @@ int TabHoverCardBubbleView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
std::unique_ptr<views::View> TabHoverCardBubbleView::CreateFootnoteView() {
if (!alert_state_.has_value())
return nullptr;
auto alert_state_label = std::make_unique<views::Label>(
base::string16(), CONTEXT_BODY_TEXT_LARGE, views::style::STYLE_PRIMARY);
alert_state_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
alert_state_label->SetMultiLine(true);
alert_state_label->SetVisible(true);
alert_state_label->SetText(chrome::GetTabAlertStateText(*alert_state_));
return alert_state_label;
}
void TabHoverCardBubbleView::Layout() {
View::Layout();
title_fade_label_->SetBoundsRect(title_label_->bounds());
......@@ -727,8 +724,10 @@ void TabHoverCardBubbleView::UpdateCardContent(const Tab* tab) {
title_fade_label_->SetText(title_label_->GetText());
title_label_->SetText(title);
if (alert_state_ != old_alert_state)
GetBubbleFrameView()->SetFootnoteView(CreateFootnoteView());
if (alert_state_ != old_alert_state) {
GetBubbleFrameView()->SetFootnoteView(
alert_state_.has_value() ? CreateAlertView(*alert_state_) : nullptr);
}
domain_fade_label_->SetText(domain_label_->GetText());
domain_label_->SetText(domain);
......
......@@ -54,7 +54,6 @@ class TabHoverCardBubbleView : public views::BubbleDialogDelegateView {
void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
ax::mojom::Role GetAccessibleWindowRole() override;
int GetDialogButtons() const override;
std::unique_ptr<views::View> CreateFootnoteView() override;
void Layout() override;
void set_last_mouse_exit_timestamp(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment