Hide TabSearchContainer in horizontal tab strip region (#35241)
* Hide TabSearchContainer in horizontal tab strip region When we have tab search button on toolbar, we should not show the the tab search container in horizontal tab strip region view. It's duplicated UI and it's not working - clicking it leads to crash
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "brave/browser/ui/views/tabs/vertical_tab_utils.h"
|
||||
#include "brave/components/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/ui/layout_constants.h"
|
||||
#include "chrome/browser/ui/tab_search_feature.h"
|
||||
#include "chrome/browser/ui/tabs/features.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_frame_view.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
@@ -143,6 +144,12 @@ void BraveHorizontalTabStripRegionView::Initialize() {
|
||||
if (auto* ntb = views::AsViewClass<TabStripControlButton>(new_tab_button_)) {
|
||||
ntb->SetVectorIcon(kLeoPlusAddIcon);
|
||||
}
|
||||
|
||||
if (features::HasTabSearchToolbarButton() && tab_search_container_) {
|
||||
// We have tab search button on toolbar, so we don't need to show the
|
||||
// tab search container in horizontal tab strip region view.
|
||||
tab_search_container_->SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN_METADATA(BraveHorizontalTabStripRegionView)
|
||||
|
||||
@@ -46,3 +46,17 @@ IN_PROC_BROWSER_TEST_F(BraveTabsSearchButtonTest, HideShowSettingTest) {
|
||||
prefs->SetBoolean(kTabsSearchShow, true);
|
||||
EXPECT_TRUE(button->GetVisible());
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(BraveTabsSearchButtonTest,
|
||||
HideTabSearchContainerInHorizontalTabStripRegionView) {
|
||||
// We always have tab search button on toolbar.
|
||||
ASSERT_TRUE(features::HasTabSearchToolbarButton());
|
||||
|
||||
if (auto* tab_search_container =
|
||||
BrowserElementsViews::From(browser())->GetViewAs<TabSearchContainer>(
|
||||
kTabSearchContainerElementId)) {
|
||||
// In case upstream created tab search container in horizontal tab strip
|
||||
// region view, we should hide it.
|
||||
EXPECT_FALSE(tab_search_container->GetVisible());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user