summaryrefslogtreecommitdiff
path: root/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-tab-hover-cards.patch
blob: 60109027379e7557828acb110f976d44cb0d08d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- chrome/browser/ui/views/tabs/tab.cc.orig
+++ chrome/browser/ui/views/tabs/tab.cc
@@ -12,6 +12,7 @@
 #include <utility>
 
 #include "base/bind.h"
+#include "base/command_line.h"
 #include "base/debug/alias.h"
 #include "base/i18n/rtl.h"
 #include "base/metrics/user_metrics.h"
@@ -641,6 +642,8 @@ void Tab::OnGestureEvent(ui::GestureEven
 }
 
 std::u16string Tab::GetTooltipText(const gfx::Point& p) const {
+  if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "tooltip")
+    return GetTooltipText(data_.title, GetAlertStateToShow(data_.alert_state));
   // Tab hover cards replace tooltips for tabs.
   return std::u16string();
 }
--- chrome/browser/ui/views/tabs/tab_strip.cc.orig
+++ chrome/browser/ui/views/tabs/tab_strip.cc
@@ -15,6 +15,7 @@
 
 #include "base/bind.h"
 #include "base/callback.h"
+#include "base/command_line.h"
 #include "base/compiler_specific.h"
 #include "base/containers/adapters.h"
 #include "base/containers/contains.h"
@@ -2153,6 +2154,8 @@ void TabStrip::OnMouseEventInTab(views::
 }
 
 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;
   // Some operations (including e.g. starting a drag) can cause the tab focus
   // to change at the same time as the tabstrip is starting to animate; the
   // hover card should not be visible at this time.
--- chrome/browser/ungoogled_flag_choices.h.orig
+++ chrome/browser/ungoogled_flag_choices.h
@@ -75,4 +75,13 @@ const FeatureEntry::Choice kCloseConfirm
      "close-confirmation",
      "multiple"},
 };
+const FeatureEntry::Choice kTabHoverCards[] = {
+    {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+    {"None",
+     "tab-hover-cards",
+     "none"},
+    {"Tooltip",
+     "tab-hover-cards",
+     "tooltip"},
+};
 #endif  // CHROME_BROWSER_UNGOOGLED_FLAG_CHOICES_H_
--- chrome/browser/ungoogled_flag_entries.h.orig
+++ chrome/browser/ungoogled_flag_entries.h
@@ -88,4 +88,8 @@
      "Custom New Tab Page",
      "Allows setting a custom URL for the new tab page.  Value can be internal (e.g. `about:blank`), external (e.g. `example.com`), or local (e.g. `file:///tmp/startpage.html`).  This applies for incognito windows as well when not set to a `chrome://` internal page.  ungoogled-chromium flag",
      kOsDesktop, ORIGIN_LIST_VALUE_TYPE("custom-ntp", "")},
+    {"tab-hover-cards",
+     "Tab Hover Cards",
+     "Allows removing the tab hover cards or using a tooltip as a replacement.  ungoogled-chromium flag.",
+     kOsDesktop, MULTI_VALUE_TYPE(kTabHoverCards)},
 #endif  // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_