Commit a78cafc5 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Only show 'Close x windows' button if x > 1

Additionally, the close icon is updated.

Bug: 995720
Change-Id: I3d8c0969def4483867fe3e6d985fe5026a955b1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866511
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Auto-Submit: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706902}
parent 15f55eb8
......@@ -592,12 +592,15 @@ void ProfileMenuView::BuildFeatureButtons() {
base::Unretained(this)));
}
AddFeatureButton(
ImageForMenu(kCloseAllIcon),
l10n_util::GetPluralStringFUTF16(IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON,
CountBrowsersFor(profile)),
base::BindRepeating(&ProfileMenuView::OnExitProfileButtonClicked,
base::Unretained(this)));
int window_count = CountBrowsersFor(profile);
if (window_count > 1) {
AddFeatureButton(
ImageForMenu(vector_icons::kCloseIcon),
l10n_util::GetPluralStringFUTF16(IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON,
window_count),
base::BindRepeating(&ProfileMenuView::OnExitProfileButtonClicked,
base::Unretained(this)));
}
// The sign-out button is always at the bottom.
if (has_unconsented_account && !has_primary_account) {
......
......@@ -809,9 +809,13 @@ constexpr ProfileMenuViewBase::ActionableItem
PROFILE_MENU_CLICK_TEST(kActionableItems_MultipleProfiles,
ProfileMenuClickTest_MultipleProfiles) {
// Add two additional profiles.
ProfileManager* profile_manager = g_browser_process->profile_manager();
CreateTestingProfile(profile_manager->GenerateNextProfileDirectoryPath());
CreateTestingProfile(profile_manager->GenerateNextProfileDirectoryPath());
// Open a second browser window for the current profile, so the
// ExitProfileButton is shown.
SetTargetBrowser(CreateBrowser(browser()->profile()));
RunTest();
}
......@@ -824,7 +828,6 @@ constexpr ProfileMenuViewBase::ActionableItem kActionableItems_SyncEnabled[] = {
ProfileMenuViewBase::ActionableItem::kAddressesButton,
ProfileMenuViewBase::ActionableItem::kSyncSettingsButton,
ProfileMenuViewBase::ActionableItem::kManageGoogleAccountButton,
ProfileMenuViewBase::ActionableItem::kExitProfileButton,
ProfileMenuViewBase::ActionableItem::kManageProfilesButton,
ProfileMenuViewBase::ActionableItem::kGuestProfileButton,
ProfileMenuViewBase::ActionableItem::kAddNewProfileButton,
......@@ -851,7 +854,6 @@ constexpr ProfileMenuViewBase::ActionableItem kActionableItems_SyncError[] = {
ProfileMenuViewBase::ActionableItem::kAddressesButton,
ProfileMenuViewBase::ActionableItem::kSyncErrorButton,
ProfileMenuViewBase::ActionableItem::kManageGoogleAccountButton,
ProfileMenuViewBase::ActionableItem::kExitProfileButton,
ProfileMenuViewBase::ActionableItem::kManageProfilesButton,
ProfileMenuViewBase::ActionableItem::kGuestProfileButton,
ProfileMenuViewBase::ActionableItem::kAddNewProfileButton,
......@@ -879,7 +881,6 @@ constexpr ProfileMenuViewBase::ActionableItem
ProfileMenuViewBase::ActionableItem::kAddressesButton,
ProfileMenuViewBase::ActionableItem::kSigninAccountButton,
ProfileMenuViewBase::ActionableItem::kManageGoogleAccountButton,
ProfileMenuViewBase::ActionableItem::kExitProfileButton,
ProfileMenuViewBase::ActionableItem::kSignoutButton,
ProfileMenuViewBase::ActionableItem::kManageProfilesButton,
ProfileMenuViewBase::ActionableItem::kGuestProfileButton,
......@@ -928,7 +929,8 @@ PROFILE_MENU_CLICK_TEST(kActionableItems_GuestProfile,
Profile* guest = g_browser_process->profile_manager()->GetProfileByPath(
ProfileManager::GetGuestProfilePath());
ASSERT_TRUE(guest);
SetTargetBrowser(chrome::FindAnyBrowser(guest, true));
// Open a second guest browser window, so the ExitProfileButton is shown.
SetTargetBrowser(CreateIncognitoBrowser(guest));
RunTest();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment