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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 256054: Explicitly activeIgnoringOtherApps from IDC_NEW{,_INCOGNITO}_WINDOW... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/mac_util.h" 9 #include "base/mac_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 default: 441 default:
442 enable = menuState_->IsCommandEnabled(tag) ? YES : NO; 442 enable = menuState_->IsCommandEnabled(tag) ? YES : NO;
443 } 443 }
444 } 444 }
445 } else if (action == @selector(terminate:)) { 445 } else if (action == @selector(terminate:)) {
446 enable = YES; 446 enable = YES;
447 } else if (action == @selector(showPreferences:)) { 447 } else if (action == @selector(showPreferences:)) {
448 enable = YES; 448 enable = YES;
449 } else if (action == @selector(orderFrontStandardAboutPanel:)) { 449 } else if (action == @selector(orderFrontStandardAboutPanel:)) {
450 enable = YES; 450 enable = YES;
451 } else if (action == @selector(newWindowFromDock:)) {
452 enable = YES;
451 } 453 }
452 return enable; 454 return enable;
453 } 455 }
454 456
455 // Called when the user picks a menu item when there are no key windows. Calls 457 // Called when the user picks a menu item when there are no key windows. Calls
456 // through to the browser object to execute the command. This assumes that the 458 // through to the browser object to execute the command. This assumes that the
457 // command is supported and doesn't check, otherwise it would have been disabled 459 // command is supported and doesn't check, otherwise it would have been disabled
458 // in the UI in validateUserInterfaceItem:. 460 // in the UI in validateUserInterfaceItem:.
459 - (void)commandDispatch:(id)sender { 461 - (void)commandDispatch:(id)sender {
460 Profile* defaultProfile = [self defaultProfile]; 462 Profile* defaultProfile = [self defaultProfile];
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 addObserver:self 662 addObserver:self
661 selector:@selector(aboutWindowClosed:) 663 selector:@selector(aboutWindowClosed:)
662 name:kUserClosedAboutNotification 664 name:kUserClosedAboutNotification
663 object:aboutController_.get()]; 665 object:aboutController_.get()];
664 } 666 }
665 if (![[aboutController_ window] isVisible]) 667 if (![[aboutController_ window] isVisible])
666 [[aboutController_ window] center]; 668 [[aboutController_ window] center];
667 [aboutController_ showWindow:self]; 669 [aboutController_ showWindow:self];
668 } 670 }
669 671
672 // Explicitly bring to the foreground when creating new windows from the dock.
673 - (void)newWindowFromDock:(id)sender {
674 [NSApp activateIgnoringOtherApps:YES];
675 [self commandDispatch:sender];
676 }
677
670 - (NSMenu*)applicationDockMenu:(id)sender { 678 - (NSMenu*)applicationDockMenu:(id)sender {
671 NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease]; 679 NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease];
672 NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC); 680 NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC);
673 scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] 681 scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
674 initWithTitle:titleStr 682 initWithTitle:titleStr
675 action:@selector(commandDispatch:) 683 action:@selector(newWindowFromDock:)
676 keyEquivalent:@""]); 684 keyEquivalent:@""]);
677 [item setTarget:self]; 685 [item setTarget:self];
678 [item setTag:IDC_NEW_WINDOW]; 686 [item setTag:IDC_NEW_WINDOW];
679 [dockMenu addItem:item]; 687 [dockMenu addItem:item];
680 688
681 titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC); 689 titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC);
682 item.reset([[NSMenuItem alloc] initWithTitle:titleStr 690 item.reset([[NSMenuItem alloc] initWithTitle:titleStr
683 action:@selector(commandDispatch:) 691 action:@selector(newWindowFromDock:)
684 keyEquivalent:@""]); 692 keyEquivalent:@""]);
685 [item setTarget:self]; 693 [item setTarget:self];
686 [item setTag:IDC_NEW_INCOGNITO_WINDOW]; 694 [item setTag:IDC_NEW_INCOGNITO_WINDOW];
687 [dockMenu addItem:item]; 695 [dockMenu addItem:item];
688 696
689 return dockMenu; 697 return dockMenu;
690 } 698 }
691 699
692 @end 700 @end
693 701
694 //--------------------------------------------------------------------------- 702 //---------------------------------------------------------------------------
695 703
696 // Stub for cross-platform method that isn't called on Mac OS X. 704 // Stub for cross-platform method that isn't called on Mac OS X.
697 void ShowOptionsWindow(OptionsPage page, 705 void ShowOptionsWindow(OptionsPage page,
698 OptionsGroup highlight_group, 706 OptionsGroup highlight_group,
699 Profile* profile) { 707 Profile* profile) {
700 NOTIMPLEMENTED(); 708 NOTIMPLEMENTED();
701 } 709 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698