From 64a2d4953a289966ab9b5dcffea1a7e382598683 Mon Sep 17 00:00:00 2001 From: "sangwoo.ko" Date: Mon, 10 Apr 2023 11:14:43 +0900 Subject: [PATCH] Set tooltip texts for toggle button on vertical tabs --- app/brave_generated_resources.grd | 20 ++++++++++++++++++ .../frame/vertical_tab_strip_region_view.cc | 21 ++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 0399b79436c1..fcf3c4f14436 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -1082,6 +1082,26 @@ Or change later at $2brave://settings/ext Imported from $1Chrome. + + + + + + Expand Tabs + + + Minimize Tabs + + + + + Expand tabs + + + Minimize tabs + + + diff --git a/browser/ui/views/frame/vertical_tab_strip_region_view.cc b/browser/ui/views/frame/vertical_tab_strip_region_view.cc index 2880d06013aa..21dee7b9d08e 100644 --- a/browser/ui/views/frame/vertical_tab_strip_region_view.cc +++ b/browser/ui/views/frame/vertical_tab_strip_region_view.cc @@ -66,10 +66,6 @@ class ToggleButton : public BraveNewTabButton { std::move(std::move(callback))), region_view_(region_view), tab_strip_(region_view_->tab_strip()) { - // TODO(sangwoo.ko) Temporary workaround before we have a proper tooltip - // text. - // https://github.com/brave/brave-browser/issues/24717 - SetProperty(views::kSkipAccessibilityPaintChecks, true); SetPreferredSize(gfx::Size{GetIconWidth(), GetIconWidth()}); } ~ToggleButton() override = default; @@ -107,6 +103,15 @@ class ToggleButton : public BraveNewTabButton { // dont' fill } + std::u16string GetTooltipText(const gfx::Point& p) const override { + if (region_view_->state() == VerticalTabStripRegionView::State::kExpanded) { + return l10n_util::GetStringUTF16(IDS_VERTICAL_TABS_MINIMIZE); + } + + // When it's minimized or floating. + return l10n_util::GetStringUTF16(IDS_VERTICAL_TABS_EXPAND); + } + #if DCHECK_IS_ON() void OnBoundsChanged(const gfx::Rect& previous_bounds) override { CHECK_EQ(width(), GetIconWidth()); @@ -251,10 +256,10 @@ class VerticalTabNewTabButton : public BraveNewTabButton { // Set additional horizontal inset for '+' icon. if (region_view_->state() == VerticalTabStripRegionView::State::kCollapsed) { - // // When |text_| is empty, the vertical tab strip could be minimized. - // // In this case we should align icon center. - // // TODO(sko) Should we keep this padding when it's transitioned to - // // floating mode? + // When |text_| is empty, the vertical tab strip could be minimized. + // In this case we should align icon center. + // TODO(sko) Should we keep this padding when it's transitioned to + // floating mode? SetImageHorizontalAlignment( views::ImageButton::HorizontalAlignment::ALIGN_CENTER); } else {