add-flag-for-tab-hover-cards.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --- a/chrome/browser/ui/views/tabs/tab.cc
  2. +++ b/chrome/browser/ui/views/tabs/tab.cc
  3. @@ -12,6 +12,7 @@
  4. #include <utility>
  5. #include "base/bind.h"
  6. +#include "base/command_line.h"
  7. #include "base/debug/alias.h"
  8. #include "base/i18n/rtl.h"
  9. #include "base/metrics/user_metrics.h"
  10. @@ -636,6 +637,8 @@ void Tab::OnGestureEvent(ui::GestureEven
  11. }
  12. std::u16string Tab::GetTooltipText(const gfx::Point& p) const {
  13. + if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "tooltip")
  14. + return GetTooltipText(data_.title, GetAlertStateToShow(data_.alert_state));
  15. // Tab hover cards replace tooltips for tabs.
  16. return std::u16string();
  17. }
  18. --- a/chrome/browser/ui/views/tabs/tab_strip.cc
  19. +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
  20. @@ -15,6 +15,7 @@
  21. #include "base/bind.h"
  22. #include "base/callback.h"
  23. +#include "base/command_line.h"
  24. #include "base/compiler_specific.h"
  25. #include "base/containers/adapters.h"
  26. #include "base/containers/contains.h"
  27. @@ -1844,6 +1845,8 @@ void TabStrip::OnMouseEventInTab(views::
  28. }
  29. void TabStrip::UpdateHoverCard(Tab* tab, HoverCardUpdateType update_type) {
  30. + if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "tooltip" ||
  31. + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "none") return;
  32. // Some operations (including e.g. starting a drag) can cause the tab focus
  33. // to change at the same time as the tabstrip is starting to animate; the
  34. // hover card should not be visible at this time.
  35. --- a/chrome/browser/ungoogled_flag_choices.h
  36. +++ b/chrome/browser/ungoogled_flag_choices.h
  37. @@ -75,4 +75,13 @@ const FeatureEntry::Choice kCloseConfirm
  38. "close-confirmation",
  39. "multiple"},
  40. };
  41. +const FeatureEntry::Choice kTabHoverCards[] = {
  42. + {flags_ui::kGenericExperimentChoiceDefault, "", ""},
  43. + {"None",
  44. + "tab-hover-cards",
  45. + "none"},
  46. + {"Tooltip",
  47. + "tab-hover-cards",
  48. + "tooltip"},
  49. +};
  50. #endif // CHROME_BROWSER_UNGOOGLED_FLAG_CHOICES_H_
  51. --- a/chrome/browser/ungoogled_flag_entries.h
  52. +++ b/chrome/browser/ungoogled_flag_entries.h
  53. @@ -84,4 +84,8 @@
  54. "Custom New Tab Page",
  55. "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",
  56. kOsDesktop, ORIGIN_LIST_VALUE_TYPE("custom-ntp", "")},
  57. + {"tab-hover-cards",
  58. + "Tab Hover Cards",
  59. + "Allows removing the tab hover cards or using a tooltip as a replacement. ungoogled-chromium flag.",
  60. + kOsDesktop, MULTI_VALUE_TYPE(kTabHoverCards)},
  61. #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_