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

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

Issue 333026: Mac: Make Cmd-[ and Cmd-] work properly again. (Closed)
Patch Set: Changed to just use a different selector instead (per Nico's comment on IRC). Created 11 years, 2 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/app/nibs/Toolbar.xib ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index b6cc9150f3b7a2c982ce99719ca87339f2f925a3..7edf5b412f1946e26a1e8343430aa2b8af23c52e 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -549,11 +549,11 @@ willPositionSheet:(NSWindow*)sheet
}
// Called to validate menu and toolbar items when this window is key. All the
-// items we care about have been set with the |commandDispatch:| action and
-// a target of FirstResponder in IB. If it's not one of those, let it
-// continue up the responder chain to be handled elsewhere. We pull out the
-// tag as the cross-platform constant to differentiate and dispatch the
-// various commands.
+// items we care about have been set with the |-commandDispatch:| or
+// |-commandDispatchUsingKeyModifiers:| actions and a target of FirstResponder
+// in IB. If it's not one of those, let it continue up the responder chain to be
+// handled elsewhere. We pull out the tag as the cross-platform constant to
+// differentiate and dispatch the various commands.
// NOTE: we might have to handle state for app-wide menu items,
// although we could cheat and directly ask the app controller if our
// command_updater doesn't support the command. This may or may not be an issue,
@@ -561,7 +561,8 @@ willPositionSheet:(NSWindow*)sheet
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
SEL action = [item action];
BOOL enable = NO;
- if (action == @selector(commandDispatch:)) {
+ if (action == @selector(commandDispatch:) ||
+ action == @selector(commandDispatchUsingKeyModifiers:)) {
NSInteger tag = [item tag];
if (browser_->command_updater()->SupportsCommand(tag)) {
// Generate return value (enabled state)
@@ -598,14 +599,6 @@ willPositionSheet:(NSWindow*)sheet
- (void)commandDispatch:(id)sender {
NSInteger tag = [sender tag];
switch (tag) {
- case IDC_FORWARD:
- case IDC_BACK:
- // For this, we need to check the key flags to figure out where to open
- // the history item. Note that |Revert()| isn't needed, since any
- // navigation in the current tab will reset the location bar's contents.
- browser_->ExecuteCommandWithDisposition(tag,
- event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]));
- return;
case IDC_RELOAD:
if ([sender isKindOfClass:[NSButton class]]) {
// We revert the bar when the reload button is pressed, but don't when
@@ -620,6 +613,14 @@ willPositionSheet:(NSWindow*)sheet
browser_->ExecuteCommand(tag);
}
+// Same as |-commandDispatch:|, but executes commands using a disposition
+// determined by the key flags.
+- (void)commandDispatchUsingKeyModifiers:(id)sender {
+ NSInteger tag = [sender tag];
+ browser_->ExecuteCommandWithDisposition(tag,
+ event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]));
+}
+
// Called when another part of the internal codebase needs to execute a
// command.
- (void)executeCommand:(int)command {
« no previous file with comments | « chrome/app/nibs/Toolbar.xib ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698