add tab hover card flag

This commit is contained in:
Alexander Frick 2024-01-04 12:48:26 -06:00
parent 1dc0e9e0ce
commit cc3c37747e
5 changed files with 26 additions and 3 deletions

View file

@ -175,7 +175,10 @@ Disable fetching Field Trials/Variations Patch - https://github.com/ungoogled-so
Enable double click to close tab flag - https://github.com/bigfoxtail/brave-core/commit/acec5efcbaa98722611f551712f051fb343af120
- Found by @gz83, modified by me.
Enable disabling tab hover cards patch - https://github.com/ungoogled-software/ungoogled-chromium/blob/master/patches/extra/ungoogled-chromium/add-flag-for-tab-hover-cards.patch
- Credit win32ss for alerting me to this patch.
Enable close confirmation patch - https://github.com/ungoogled-software/ungoogled-chromium/blob/master/patches/extra/ungoogled-chromium/add-flag-for-close-confirmation.patch
- Modified by me.

View file

@ -100,6 +100,16 @@ const FeatureEntry::Choice kForceGpuMemAvailableMbChoices[] = {
"force-gpu-mem-available-mb", "1024"},
};
const FeatureEntry::Choice kTabHoverCardChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
{"None",
"tab-hover-cards",
"none"},
{"Tooltip",
"tab-hover-cards",
"tooltip"},
};
const FeatureEntry::Choice kCloseConfirmation[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
{"Show confirmation with last window",

View file

@ -114,6 +114,10 @@
"Double Click to Close Tab",
"Enables double clicking a tab to close it.",
kOsDesktop, SINGLE_VALUE_TYPE("double-click-close-tab")},
{"tab-hover-cards",
"Tab Hover Cards",
"Allows removing the tab hover cards or using a tooltip as a replacement.",
kOsDesktop, MULTI_VALUE_TYPE(kTabHoverCardChoices)},
#if !BUILDFLAG(IS_ANDROID)
{"media-router",

View file

@ -709,8 +709,12 @@ void Tab::OnGestureEvent(ui::GestureEvent* event) {
}
std::u16string Tab::GetTooltipText(const gfx::Point& p) const {
// Tab hover cards replace tooltips for tabs.
return std::u16string();
// Tab hover cards don't replace tooltips for tabs in all cases.
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "tooltip") {
return GetTooltipText(data_.title, GetAlertStateToShow(data_.alert_state));
} else {
return std::u16string();
}
}
void Tab::GetAccessibleNodeData(ui::AXNodeData* node_data) {

View file

@ -1660,6 +1660,8 @@ void TabStrip::OnMouseEventInTab(views::View* source,
}
void TabStrip::UpdateHoverCard(Tab* tab, HoverCardUpdateType update_type) {
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "tooltip" ||
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "none") return;
tab_container_->UpdateHoverCard(tab, update_type);
}