From 3d4bd23ffafc9e4cdb423e0f3e524976969097e3 Mon Sep 17 00:00:00 2001 From: "sgk@google.com" Date: Tue, 6 Oct 2009 03:58:38 +0000 Subject: Explicitly activeIgnoringOtherApps from IDC_NEW{,_INCOGNITO}_WINDOW in app_controller_mac.mm, under the assumption we're either already the foreground app or should become the foreground mac (when created from the dock menu). BUG=22595 TEST="New Window" or "New Incognito Window" from dock menu with other app in foreground Review URL: http://codereview.chromium.org/256054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28091 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/app_controller_mac.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'chrome/browser/app_controller_mac.mm') diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index c56aa46..a45907e 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -448,6 +448,8 @@ enable = YES; } else if (action == @selector(orderFrontStandardAboutPanel:)) { enable = YES; + } else if (action == @selector(newWindowFromDock:)) { + enable = YES; } return enable; } @@ -667,12 +669,18 @@ [aboutController_ showWindow:self]; } +// Explicitly bring to the foreground when creating new windows from the dock. +- (void)newWindowFromDock:(id)sender { + [NSApp activateIgnoringOtherApps:YES]; + [self commandDispatch:sender]; +} + - (NSMenu*)applicationDockMenu:(id)sender { NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease]; NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC); scoped_nsobject item([[NSMenuItem alloc] initWithTitle:titleStr - action:@selector(commandDispatch:) + action:@selector(newWindowFromDock:) keyEquivalent:@""]); [item setTarget:self]; [item setTag:IDC_NEW_WINDOW]; @@ -680,7 +688,7 @@ titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC); item.reset([[NSMenuItem alloc] initWithTitle:titleStr - action:@selector(commandDispatch:) + action:@selector(newWindowFromDock:) keyEquivalent:@""]); [item setTarget:self]; [item setTag:IDC_NEW_INCOGNITO_WINDOW]; -- cgit v1.1