Commit 9a8c5c02 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Add 'Close x windows' string

Bug: 995720
Change-Id: I96acb6008bd074d9e68ddab1b8b4fc205ce1ab6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862689
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Auto-Submit: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705945}
parent c2e97184
......@@ -108,6 +108,12 @@
<message name="IDS_PROFILES_EXIT_GUEST" desc="Button in the avatar menu bubble view for exiting the active guest session.">
Exit Guest
</message>
<message name="IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON" desc="Button in the profile menu to close all windows of the current profile. This is not used for zero windows.">
{0, plural,
=1 {Close # window}
other {Close # windows}
}
</message>
<message name="IDS_PROFILES_SIGNIN_PROMO" desc="Text describing the benefits of signing in.">
Sign in to get your bookmarks, history, passwords, and other settings on all your devices.
</message>
......
......@@ -27,6 +27,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
......@@ -133,6 +134,15 @@ gfx::ImageSkia GetGoogleIconForUserMenu(int icon_size) {
}
#endif
// Returns the number of browsers associated with |profile|.
// Note: For regular profiles this includes incognito sessions.
int CountBrowsersFor(Profile* profile) {
int browser_count = chrome::GetBrowserCount(profile);
if (!profile->IsOffTheRecord() && profile->HasOffTheRecordProfile())
browser_count += chrome::GetBrowserCount(profile->GetOffTheRecordProfile());
return browser_count;
}
} // namespace
// ProfileMenuView ---------------------------------------------------------
......@@ -545,9 +555,10 @@ void ProfileMenuView::BuildSyncInfo() {
}
void ProfileMenuView::BuildFeatureButtons() {
Profile* profile = browser()->profile();
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(browser()->profile());
const bool is_guest = browser()->profile()->IsGuestSession();
IdentityManagerFactory::GetForProfile(profile);
const bool is_guest = profile->IsGuestSession();
const bool has_unconsented_account =
!is_guest && identity_manager->HasUnconsentedPrimaryAccount();
const bool has_primary_account =
......@@ -570,7 +581,8 @@ void ProfileMenuView::BuildFeatureButtons() {
AddFeatureButton(
ImageForMenu(kCloseAllIcon),
l10n_util::GetStringUTF16(IDS_PROFILES_CLOSE_ALL_WINDOWS_BUTTON),
l10n_util::GetPluralStringFUTF16(IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON,
CountBrowsersFor(profile)),
base::BindRepeating(&ProfileMenuView::OnExitProfileButtonClicked,
base::Unretained(this)));
......
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