From 78593d016afa80146fb52630de6533eb2b79859d Mon Sep 17 00:00:00 2001 From: cdesouza-chromium Date: Wed, 1 Nov 2023 03:41:38 +0000 Subject: [PATCH] `Label::CalculatePreferredSize()` marked as `final` (#20767) This function is now marked as `final`, however there is another entry in the overload set that can be used in its place for the override in `BraveVPNStatusLabel`. Chromium change: https://chromium.googlesource.com/chromium/src/+/bf2f84a8c4f27e399e05bf4730a29152f6a8b0b6 commit bf2f84a8c4f27e399e05bf4730a29152f6a8b0b6 Author: weidongliu Date: Mon Oct 30 15:59:03 2023 +0000 views: Mark CalculatePreferredSize() of views::Label as final Views::Label now has two functions to calculate the preferred size. This can cause some unexpected errors. CalculatePreferredSize() is now expected to be deprecated. Therefore, mark it as final to prevent overrided by subclasses. Bug: 1346889 --- browser/ui/views/toolbar/brave_vpn_status_label.cc | 5 +++-- browser/ui/views/toolbar/brave_vpn_status_label.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/browser/ui/views/toolbar/brave_vpn_status_label.cc b/browser/ui/views/toolbar/brave_vpn_status_label.cc index 020bb6e5c9e6..9f7f557e2a0b 100644 --- a/browser/ui/views/toolbar/brave_vpn_status_label.cc +++ b/browser/ui/views/toolbar/brave_vpn_status_label.cc @@ -75,8 +75,9 @@ void BraveVPNStatusLabel::OnConnectionStateChanged(ConnectionState state) { UpdateState(); } -gfx::Size BraveVPNStatusLabel::CalculatePreferredSize() const { - auto size = views::Label::CalculatePreferredSize(); +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 = diff --git a/browser/ui/views/toolbar/brave_vpn_status_label.h b/browser/ui/views/toolbar/brave_vpn_status_label.h index 399c56e7d506..8522a7b3acc7 100644 --- a/browser/ui/views/toolbar/brave_vpn_status_label.h +++ b/browser/ui/views/toolbar/brave_vpn_status_label.h @@ -25,7 +25,8 @@ class BraveVPNStatusLabel : public views::Label, BraveVPNStatusLabel(const BraveVPNStatusLabel&) = delete; BraveVPNStatusLabel& operator=(const BraveVPNStatusLabel&) = delete; - gfx::Size CalculatePreferredSize() const override; + gfx::Size CalculatePreferredSize( + const views::SizeBounds& available_size) const override; private: // brave_vpn::BraveVPNServiceObserver overrides: