diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 17:50:21 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 17:50:21 +0000 |
commit | a1ff529fcffcded364926b58c1f2c8afc839adeb (patch) | |
tree | 2f9bfc03ba5fa1b908b46aacf243121f2bf15676 /chrome/browser/cocoa | |
parent | 290c537c88b3b7ebeec09c4942fc029437ca05e0 (diff) | |
download | chromium_src-a1ff529fcffcded364926b58c1f2c8afc839adeb.zip chromium_src-a1ff529fcffcded364926b58c1f2c8afc839adeb.tar.gz chromium_src-a1ff529fcffcded364926b58c1f2c8afc839adeb.tar.bz2 |
Handle updating the menu in the case where all the entries get removed from the tab restore service. Increase the # of recently closed items to 5.
BUG=35290
TEST=per bug, history menu should work as before.
Review URL: http://codereview.chromium.org/596086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/history_menu_bridge.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/history_menu_bridge.mm b/chrome/browser/cocoa/history_menu_bridge.mm index 0f0693c..7a580ee 100644 --- a/chrome/browser/cocoa/history_menu_bridge.mm +++ b/chrome/browser/cocoa/history_menu_bridge.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,7 +30,7 @@ const static int kMostVisitedScope = 90; const static int kMostVisitedCount = 9; // The number of recently closed items to get. -const static unsigned int kRecentlyClosedCount = 4; +const static unsigned int kRecentlyClosedCount = 5; } @@ -114,6 +114,12 @@ void HistoryMenuBridge::TabRestoreServiceChanged(TabRestoreService* service) { NSMenu* menu = HistoryMenu(); ClearMenuSection(menu, IDC_HISTORY_MENU_CLOSED, closed_results_.size()); + // If the number of entries in the tab restore service is less than + // what's cached, throw it away and rebuild it. It probably means + // the browsing data was cleared by the user. + if (entries.size() < closed_results_.size()) + closed_results_.clear(); + unsigned int added_count = 0; for (TabRestoreService::Entries::const_iterator it = entries.begin(); it != entries.end() && added_count < kRecentlyClosedCount; ++it) { |