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

Unified Diff: chrome/browser/cocoa/tab_controller.mm

Issue 155173: Add context menus to tabs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/tab_controller.h ('k') | chrome/browser/cocoa/tab_controller_target.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_controller.mm
===================================================================
--- chrome/browser/cocoa/tab_controller.mm (revision 20045)
+++ chrome/browser/cocoa/tab_controller.mm (working copy)
@@ -55,6 +55,22 @@
}
}
+// Dispatches the command in the tag to the registered target object.
+- (IBAction)commandDispatch:(id)sender {
+ TabStripModel::ContextMenuCommand command =
+ static_cast<TabStripModel::ContextMenuCommand>([sender tag]);
+ [[self target] commandDispatch:command forController:self];
+}
+
+// Called for each menu item on its target, which would be this controller.
+// Returns YES if the menu item should be enabled. We ask the tab's
+// target for the proper answer.
+- (BOOL)validateMenuItem:(NSMenuItem*)item {
+ TabStripModel::ContextMenuCommand command =
+ static_cast<TabStripModel::ContextMenuCommand>([item tag]);
+ return [[self target] isCommandEnabled:command forController:self];
+}
+
- (void)setTitle:(NSString *)title {
[backgroundButton_ setToolTip:title];
[super setTitle:title];
« no previous file with comments | « chrome/browser/cocoa/tab_controller.h ('k') | chrome/browser/cocoa/tab_controller_target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698