Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 7565007: Clicking tab close with option key close the other tabs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed rsesek's comments. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 TabStripModel::CLOSE_USER_GESTURE | 736 TabStripModel::CLOSE_USER_GESTURE |
737 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 737 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
738 } else { 738 } else {
739 // Use the standard window close if this is the last tab 739 // Use the standard window close if this is the last tab
740 // this prevents the tab from being removed from the model until after 740 // this prevents the tab from being removed from the model until after
741 // the window dissapears 741 // the window dissapears
742 [[tabStripView_ window] performClose:nil]; 742 [[tabStripView_ window] performClose:nil];
743 } 743 }
744 } 744 }
745 745
746 // Called when the user closes all tabs except for the current tab.
747 // Invoke the |CommandCloseOtherTabs| context menu command.
748 - (void)closeOtherTabs:(id)sender {
749 int index = [self modelIndexForTabView:sender];
750 if (tabStripModel_->ContainsIndex(index))
751 tabStripModel_->ExecuteContextMenuCommand(
752 index, TabStripModel::CommandCloseOtherTabs);
753 }
754
746 // Dispatch context menu commands for the given tab controller. 755 // Dispatch context menu commands for the given tab controller.
747 - (void)commandDispatch:(TabStripModel::ContextMenuCommand)command 756 - (void)commandDispatch:(TabStripModel::ContextMenuCommand)command
748 forController:(TabController*)controller { 757 forController:(TabController*)controller {
749 int index = [self modelIndexForTabView:[controller view]]; 758 int index = [self modelIndexForTabView:[controller view]];
750 if (tabStripModel_->ContainsIndex(index)) 759 if (tabStripModel_->ContainsIndex(index))
751 tabStripModel_->ExecuteContextMenuCommand(index, command); 760 tabStripModel_->ExecuteContextMenuCommand(index, command);
752 } 761 }
753 762
754 // Returns YES if the specificed command should be enabled for the given 763 // Returns YES if the specificed command should be enabled for the given
755 // controller. 764 // controller.
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 NSInteger index = [self indexFromModelIndex:modelIndex]; 2030 NSInteger index = [self indexFromModelIndex:modelIndex];
2022 BrowserWindowController* controller = 2031 BrowserWindowController* controller =
2023 (BrowserWindowController*)[[switchView_ window] windowController]; 2032 (BrowserWindowController*)[[switchView_ window] windowController];
2024 DCHECK(index >= 0); 2033 DCHECK(index >= 0);
2025 if (index >= 0) { 2034 if (index >= 0) {
2026 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; 2035 [controller setTab:[self viewAtIndex:index] isDraggable:YES];
2027 } 2036 }
2028 } 2037 }
2029 2038
2030 @end 2039 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698