summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/history_menu_cocoa_controller.mm
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 22:30:51 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 22:30:51 +0000
commit2b6eb7a41393fad6757ad261130f6eb109903a60 (patch)
tree08fdf00136ec0495e55dbcba1836cd69ce26614e /chrome/browser/cocoa/history_menu_cocoa_controller.mm
parent4f73d569a58162958e75eecb6eae1059280e8ce7 (diff)
downloadchromium_src-2b6eb7a41393fad6757ad261130f6eb109903a60.zip
chromium_src-2b6eb7a41393fad6757ad261130f6eb109903a60.tar.gz
chromium_src-2b6eb7a41393fad6757ad261130f6eb109903a60.tar.bz2
Re-land r40275 (broke TabRestoreUITest.RestoreIntoSameWindow).
[Mac] Add favicons to the history menu. BUG=20464 TEST=Open History menu, see icons. Original CL: http://codereview.chromium.org/660250 As a side effect of fixing the bustage, we no longer list duplicate sites in the "Recently Closed" section. BUG=21314 TEST=Open and navigate two three different sites. Close the first one. History menu has 1 closed site. Close second tab. Should see both sites listed under "Recently Closed" exactly once. Review URL: http://codereview.chromium.org/660282 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40308 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/history_menu_cocoa_controller.mm')
-rw-r--r--chrome/browser/cocoa/history_menu_cocoa_controller.mm17
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/cocoa/history_menu_cocoa_controller.mm b/chrome/browser/cocoa/history_menu_cocoa_controller.mm
index 89dd2f8..a0672b3 100644
--- a/chrome/browser/cocoa/history_menu_cocoa_controller.mm
+++ b/chrome/browser/cocoa/history_menu_cocoa_controller.mm
@@ -1,7 +1,8 @@
-// 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.
+#include "base/scoped_vector.h"
#include "chrome/app/chrome_dll_resource.h" // IDC_HISTORY_MENU
#include "chrome/browser/browser.h"
#import "chrome/browser/cocoa/history_menu_cocoa_controller.h"
@@ -24,16 +25,16 @@
}
// Open the URL of the given history item in the current tab.
-- (void)openURLForItem:(HistoryMenuBridge::HistoryItem&)node {
+- (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node {
Browser* browser = Browser::GetOrCreateTabbedBrowser(bridge_->profile());
WindowOpenDisposition disposition =
event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
- browser->OpenURL(node.url, GURL(), disposition,
+ browser->OpenURL(node->url, GURL(), disposition,
PageTransition::AUTO_BOOKMARK);
}
-- (HistoryMenuBridge::HistoryItem)itemForTag:(NSInteger)tag {
- std::vector<HistoryMenuBridge::HistoryItem>* results = NULL;
+- (const HistoryMenuBridge::HistoryItem*)itemForTag:(NSInteger)tag {
+ const ScopedVector<HistoryMenuBridge::HistoryItem>* results = NULL;
NSInteger tag_base = 0;
if (tag > IDC_HISTORY_MENU_VISITED && tag < IDC_HISTORY_MENU_CLOSED) {
results = bridge_->visited_results();
@@ -48,14 +49,14 @@
DCHECK(tag > tag_base);
size_t index = tag - tag_base - 1;
if (index >= results->size())
- return HistoryMenuBridge::HistoryItem();
+ return NULL;
return (*results)[index];
}
- (IBAction)openHistoryMenuItem:(id)sender {
NSInteger tag = [sender tag];
- HistoryMenuBridge::HistoryItem item = [self itemForTag:tag];
- DCHECK(item.url.is_valid());
+ const HistoryMenuBridge::HistoryItem* item = [self itemForTag:tag];
+ DCHECK(item->url.is_valid());
[self openURLForItem:item];
}