summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/history_menu_bridge.mm
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 18:12:40 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 18:12:40 +0000
commit572ae0ab116c50423da6cd0fecbd3cab4567aa12 (patch)
tree797507ee3987600a95d97e2d4b3ab348215b7d99 /chrome/browser/cocoa/history_menu_bridge.mm
parent93364da20a7f3cf14a4d4710cf64b4ef84444dd5 (diff)
downloadchromium_src-572ae0ab116c50423da6cd0fecbd3cab4567aa12.zip
chromium_src-572ae0ab116c50423da6cd0fecbd3cab4567aa12.tar.gz
chromium_src-572ae0ab116c50423da6cd0fecbd3cab4567aa12.tar.bz2
[Mac] Display the correct number of restorable tabs in the History menu.
BUG=47797 TEST=Open a new window, create 4 NTP tabs and 1 navigated tab. Close the window. The History menu has a "1 Tab" submenu with the navigated page. Review URL: http://codereview.chromium.org/2800032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/history_menu_bridge.mm')
-rw-r--r--chrome/browser/cocoa/history_menu_bridge.mm24
1 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/history_menu_bridge.mm b/chrome/browser/cocoa/history_menu_bridge.mm
index fb40e9b..7795bf7 100644
--- a/chrome/browser/cocoa/history_menu_bridge.mm
+++ b/chrome/browser/cocoa/history_menu_bridge.mm
@@ -160,16 +160,11 @@ void HistoryMenuBridge::TabRestoreServiceChanged(TabRestoreService* service) {
if (!tabs.size())
continue;
- // Create the item for the parent/window.
+ // Create the item for the parent/window. Do not set the title yet because
+ // the actual number of items that are in the menu will not be known until
+ // things like the NTP are filtered out, which is done when the tab items
+ // are actually created.
HistoryItem* item = new HistoryItem();
- if (tabs.size() == 1) {
- item->title = l10n_util::GetStringUTF16(
- IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE);
- } else {
- item->title =l10n_util::GetStringFUTF16(
- IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE,
- IntToString16(tabs.size()));
- }
item->session_id = entry_win->id;
// Create the submenu.
@@ -204,6 +199,17 @@ void HistoryMenuBridge::TabRestoreServiceChanged(TabRestoreService* service) {
}
}
+ // Now that the number of tabs that has been added is known, set the title
+ // of the parent menu item.
+ if (item->tabs.size() == 1) {
+ item->title = l10n_util::GetStringUTF16(
+ IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE);
+ } else {
+ item->title =l10n_util::GetStringFUTF16(
+ IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE,
+ IntToString16(item->tabs.size()));
+ }
+
// Sometimes it is possible for there to not be any subitems for a given
// window; if that is the case, do not add the entry to the main menu.
if ([[submenu itemArray] count] > 2) {