From 4a70290c05e7e719b272f2262ce1c817561b7c84 Mon Sep 17 00:00:00 2001 From: brave-builds <45370463+brave-builds@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:22:48 +0200 Subject: [PATCH] Remove `CalculatePreferredSize` from `BraveVPNStatusLabel` (uplift to 1.71.x) (#25598) Uplift of #25595 (squashed) to beta --- .../ui/views/toolbar/brave_vpn_status_label.cc | 15 --------------- browser/ui/views/toolbar/brave_vpn_status_label.h | 3 --- 2 files changed, 18 deletions(-) diff --git a/browser/ui/views/toolbar/brave_vpn_status_label.cc b/browser/ui/views/toolbar/brave_vpn_status_label.cc index 1ee6aba4bd94..37b3c9977ca7 100644 --- a/browser/ui/views/toolbar/brave_vpn_status_label.cc +++ b/browser/ui/views/toolbar/brave_vpn_status_label.cc @@ -76,21 +76,6 @@ void BraveVPNStatusLabel::OnConnectionStateChanged(ConnectionState state) { UpdateState(); } -gfx::Size BraveVPNStatusLabel::CalculatePreferredSize( - const views::SizeBounds& available_size) const { - auto size = views::Label::CalculatePreferredSize(available_size); - if (longest_state_string_id_ == -1) - return size; - auto text = - brave_l10n::GetLocalizedResourceUTF16String(longest_state_string_id_); - if (text == GetText()) - return size; - size.set_width(font_list().GetExpectedTextWidth(text.length()) + - GetInsets().width()); - size.set_height(GetHeightForWidth(size.width())); - return size; -} - void BraveVPNStatusLabel::UpdateState() { const auto state = service_->GetConnectionState(); diff --git a/browser/ui/views/toolbar/brave_vpn_status_label.h b/browser/ui/views/toolbar/brave_vpn_status_label.h index f2d6f5ff331a..ec08ceaf9c0e 100644 --- a/browser/ui/views/toolbar/brave_vpn_status_label.h +++ b/browser/ui/views/toolbar/brave_vpn_status_label.h @@ -27,9 +27,6 @@ class BraveVPNStatusLabel : public views::Label, BraveVPNStatusLabel(const BraveVPNStatusLabel&) = delete; BraveVPNStatusLabel& operator=(const BraveVPNStatusLabel&) = delete; - gfx::Size CalculatePreferredSize( - const views::SizeBounds& available_size) const override; - private: // brave_vpn::BraveVPNServiceObserver overrides: void OnConnectionStateChanged(