add-flag-to-hide-extensions-menu.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
  2. +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
  3. @@ -7,6 +7,7 @@
  4. #include <memory>
  5. #include "base/bind.h"
  6. #include "base/callback_helpers.h"
  7. +#include "base/command_line.h"
  8. #include "base/cxx17_backports.h"
  9. #include "base/feature_list.h"
  10. #include "base/no_destructor.h"
  11. @@ -26,6 +27,7 @@
  12. #include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h"
  13. #include "chrome/browser/ui/views/frame/browser_view.h"
  14. #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
  15. +#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
  16. #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_view.h"
  17. #include "extensions/common/extension_features.h"
  18. #include "ui/base/dragdrop/drag_drop_types.h"
  19. @@ -318,6 +320,17 @@ void ExtensionsToolbarContainer::AnchorA
  20. widget->widget_delegate()->AsBubbleDialogDelegate()->SetAnchorView(
  21. anchor_view && anchor_view->GetVisible() ? anchor_view
  22. : GetExtensionsButton());
  23. +
  24. + // Fix the position of widgets. Without this fix, extension-installed-bubble
  25. + // and extension-uninstall-dialog may be out of the window border on Linux.
  26. + if (base::CommandLine::ForCurrentProcess()->HasSwitch("hide-extensions-menu"))
  27. + {
  28. + views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser_)
  29. + ->toolbar_button_provider()->GetAppMenuButton();
  30. + widget->widget_delegate()->AsBubbleDialogDelegate()
  31. + ->SetAnchorView(anchor_view);
  32. + }
  33. +
  34. widget->Show();
  35. }
  36. @@ -810,6 +823,9 @@ void ExtensionsToolbarContainer::UpdateC
  37. }
  38. bool ExtensionsToolbarContainer::ShouldContainerBeVisible() const {
  39. + if (base::CommandLine::ForCurrentProcess()->HasSwitch("hide-extensions-menu"))
  40. + return false;
  41. +
  42. // The container (and extensions-menu button) should not be visible if we have
  43. // no extensions.
  44. if (!HasAnyExtensions())
  45. --- a/chrome/browser/ungoogled_flag_entries.h
  46. +++ b/chrome/browser/ungoogled_flag_entries.h
  47. @@ -112,4 +112,8 @@
  48. "Disable link drag",
  49. "Prevents dragging of links and selected text. ungoogled-chromium flag.",
  50. kOsDesktop, FEATURE_VALUE_TYPE(blink::features::kDisableLinkDrag)},
  51. + {"hide-extensions-menu",
  52. + "Hide Extensions Menu",
  53. + "Hides the extensions menu (the puzzle piece icon). ungoogled-chromium flag.",
  54. + kOsDesktop, SINGLE_VALUE_TYPE("hide-extensions-menu")},
  55. #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_