Skip to content

Commit

Permalink
Remove CalculatePreferredSize from BraveVPNStatusLabel
Browse files Browse the repository at this point in the history
This is no longer needed; it was put in place with
#13374 but recent changes in
Chromium 129 have made this obsolete (and it causes recursion).

See https://issues.chromium.org/issues/40232718 for more info

Fixes brave/brave-browser#41084
  • Loading branch information
bsclifton committed Sep 17, 2024
1 parent 7384ede commit 38c7156
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
15 changes: 0 additions & 15 deletions browser/ui/views/toolbar/brave_vpn_status_label.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 0 additions & 3 deletions browser/ui/views/toolbar/brave_vpn_status_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 38c7156

Please sign in to comment.