Skip to content

Commit

Permalink
Fixed empty space is added in guest window's app menu (uplift to 1.74…
Browse files Browse the repository at this point in the history
….x) (#26974)

Uplift of #26883 (squashed) to beta
  • Loading branch information
brave-builds authored Dec 11, 2024
1 parent 041ffab commit f062e82
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions browser/ui/toolbar/brave_app_menu_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,21 @@ void BraveAppMenuModel::BuildBraveProductsSection() {

#if defined(TOOLKIT_VIEWS)
if (sidebar::CanUseSidebar(browser())) {
auto index = GetNextIndexOfBraveProductsSection();
// Remove above separator as sidebar will add its top & bottom
// separator.
// If |need_separator| is false, there is no item after window section
// entry and separator. In this case, need to remove that separator because
// we will add different type of separators around sidebar menu entry.
if (!need_separator) {
RemoveItemAt(index - 1);
index--;
}

// Don't need finish this section with more separator as
// we'll add another separators around sidebar menu entry below.
need_separator = false;

sidebar_show_option_model_ = std::make_unique<ui::ButtonMenuItemModel>(
IDS_APP_MENU_SIDEBAR_TITLE, this);

Expand All @@ -182,16 +197,16 @@ void BraveAppMenuModel::BuildBraveProductsSection() {
IDC_SIDEBAR_SHOW_OPTION_MOUSEOVER, IDS_APP_MENU_SIDEBAR_HOVER);
sidebar_show_option_model_->AddGroupItemWithStringId(
IDC_SIDEBAR_SHOW_OPTION_NEVER, IDS_APP_MENU_SIDEBAR_OFF);
const auto index = GetNextIndexOfBraveProductsSection();

// Add additional spacing because LOWER|UPPER separator has more narrow
// spacing then normal separator.
InsertSeparatorAt(index++, ui::SPACING_SEPARATOR);
InsertSeparatorAt(index++, ui::LOWER_SEPARATOR);
AddButtonItemAt(IDC_SIDEBAR_SHOW_OPTION_MENU,
sidebar_show_option_model_.get(),
static_cast<size_t>(index));
// Insert separator to the top and bottom
InsertSeparatorAt(index, ui::LOWER_SEPARATOR);
InsertSeparatorAt(index + 2, ui::UPPER_SEPARATOR);

// Already added separator.
need_separator = false;
static_cast<size_t>(index++));
InsertSeparatorAt(index++, ui::UPPER_SEPARATOR);
InsertSeparatorAt(index, ui::SPACING_SEPARATOR);
}
#endif
if (need_separator) {
Expand Down

0 comments on commit f062e82

Please sign in to comment.