summaryrefslogtreecommitdiffstats
path: root/chrome/browser/back_forward_menu_model.cc
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 20:50:29 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 20:50:29 +0000
commit3698f173be9c6bf67816ad7e1ec194dd83438cba (patch)
treedd95954931d37a7183881dda2778d0f14d9d7e7e /chrome/browser/back_forward_menu_model.cc
parent4462559524df6726acc2400113508f3dc22b3648 (diff)
downloadchromium_src-3698f173be9c6bf67816ad7e1ec194dd83438cba.zip
chromium_src-3698f173be9c6bf67816ad7e1ec194dd83438cba.tar.gz
chromium_src-3698f173be9c6bf67816ad7e1ec194dd83438cba.tar.bz2
[Mac] Honor modifier keys in back/forward menu.
Add a method ActivatedAtWithDisposition to BackForwardMenuModel that navigates to a history item with a certain window disposition (current tab, new background/foreground tab). Change BackForwardMenuController to call ActivatedAtWithDisposition with the disposition created from the current NSEvent. Also, factor out some common code in Browser::GoBack and GoForward. BUG=37984 TEST=Navigate to a history item in the back/forward menu while holding down the command key. The item should open in a new tab. Likewise, holding down cmd-shift should open it in a new foreground tab. Review URL: http://codereview.chromium.org/910001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/back_forward_menu_model.cc')
-rw-r--r--chrome/browser/back_forward_menu_model.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/chrome/browser/back_forward_menu_model.cc b/chrome/browser/back_forward_menu_model.cc
index 7d54e94..e1bc742 100644
--- a/chrome/browser/back_forward_menu_model.cc
+++ b/chrome/browser/back_forward_menu_model.cc
@@ -127,14 +127,20 @@ void BackForwardMenuModel::HighlightChangedTo(int index) {
}
void BackForwardMenuModel::ActivatedAt(int index) {
- NavigationController& controller = GetTabContents()->controller();
+ ActivatedAtWithDisposition(index, CURRENT_TAB);
+}
+
+void BackForwardMenuModel::ActivatedAtWithDisposition(
+ int index,
+ WindowOpenDisposition disposition) {
+ Profile* profile = browser_->profile();
DCHECK(!IsSeparator(index));
// Execute the command for the last item: "Show Full History".
if (index == GetItemCount() - 1) {
UserMetrics::RecordComputedAction(BuildActionName("ShowFullHistory", -1),
- controller.profile());
+ profile);
browser_->ShowSingletonTab(GURL(chrome::kChromeUIHistoryURL));
return;
}
@@ -142,18 +148,18 @@ void BackForwardMenuModel::ActivatedAt(int index) {
// Log whether it was a history or chapter click.
if (index < GetHistoryItemCount()) {
UserMetrics::RecordComputedAction(
- BuildActionName("HistoryClick", index), controller.profile());
+ BuildActionName("HistoryClick", index), profile);
} else {
UserMetrics::RecordComputedAction(
BuildActionName("ChapterClick", index - GetHistoryItemCount() - 1),
- controller.profile());
+ profile);
}
int controller_index = MenuIndexToNavEntryIndex(index);
- if (controller_index >= 0 && controller_index < controller.entry_count())
- controller.GoToIndex(controller_index);
- else
+ if (!browser_->NavigateToIndexWithDisposition(controller_index,
+ disposition)) {
NOTREACHED();
+ }
}
void BackForwardMenuModel::MenuWillShow() {