--- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc @@ -7,6 +7,7 @@ #include #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/command_line.h" #include "base/cxx17_backports.h" #include "base/feature_list.h" #include "base/no_destructor.h" @@ -26,6 +27,7 @@ #include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" +#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_view.h" #include "extensions/common/extension_features.h" #include "ui/base/dragdrop/drag_drop_types.h" @@ -318,6 +320,17 @@ void ExtensionsToolbarContainer::AnchorA widget->widget_delegate()->AsBubbleDialogDelegate()->SetAnchorView( anchor_view && anchor_view->GetVisible() ? anchor_view : GetExtensionsButton()); + + // Fix the position of widgets. Without this fix, extension-installed-bubble + // and extension-uninstall-dialog may be out of the window border on Linux. + if (base::CommandLine::ForCurrentProcess()->HasSwitch("hide-extensions-menu")) + { + views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser_) + ->toolbar_button_provider()->GetAppMenuButton(); + widget->widget_delegate()->AsBubbleDialogDelegate() + ->SetAnchorView(anchor_view); + } + widget->Show(); } @@ -810,6 +823,9 @@ void ExtensionsToolbarContainer::UpdateC } bool ExtensionsToolbarContainer::ShouldContainerBeVisible() const { + if (base::CommandLine::ForCurrentProcess()->HasSwitch("hide-extensions-menu")) + return false; + // The container (and extensions-menu button) should not be visible if we have // no extensions. if (!HasAnyExtensions()) --- a/chrome/browser/ungoogled_flag_entries.h +++ b/chrome/browser/ungoogled_flag_entries.h @@ -112,4 +112,8 @@ "Disable link drag", "Prevents dragging of links and selected text. ungoogled-chromium flag.", kOsDesktop, FEATURE_VALUE_TYPE(blink::features::kDisableLinkDrag)}, + {"hide-extensions-menu", + "Hide Extensions Menu", + "Hides the extensions menu (the puzzle piece icon). ungoogled-chromium flag.", + kOsDesktop, SINGLE_VALUE_TYPE("hide-extensions-menu")}, #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_