| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 enable = YES; | 998 enable = YES; |
| 999 } else if (action == @selector(toggleConfirmToQuit:)) { | 999 } else if (action == @selector(toggleConfirmToQuit:)) { |
| 1000 [self updateConfirmToQuitPrefMenuItem:static_cast<NSMenuItem*>(item)]; | 1000 [self updateConfirmToQuitPrefMenuItem:static_cast<NSMenuItem*>(item)]; |
| 1001 enable = YES; | 1001 enable = YES; |
| 1002 } else if (action == @selector(executeApplication:)) { | 1002 } else if (action == @selector(executeApplication:)) { |
| 1003 enable = YES; | 1003 enable = YES; |
| 1004 } | 1004 } |
| 1005 return enable; | 1005 return enable; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 // Called when the user picks a menu item when there are no key windows, or when | |
| 1009 // there is no foreground browser window. Calls through to the browser object to | |
| 1010 // execute the command. This assumes that the command is supported and doesn't | |
| 1011 // check, otherwise it should have been disabled in the UI in | |
| 1012 // |-validateUserInterfaceItem:|. | |
| 1013 - (void)commandDispatch:(id)sender { | 1008 - (void)commandDispatch:(id)sender { |
| 1014 Profile* lastProfile = [self safeLastProfileForNewWindows]; | 1009 Profile* lastProfile = [self safeLastProfileForNewWindows]; |
| 1015 | 1010 |
| 1016 // Handle the case where we're dispatching a command from a sender that's in a | 1011 // Handle the case where we're dispatching a command from a sender that's in a |
| 1017 // browser window. This means that the command came from a background window | 1012 // browser window. This means that the command came from a background window |
| 1018 // and is getting here because the foreground window is not a browser window. | 1013 // and is getting here because the foreground window is not a browser window. |
| 1019 if ([sender respondsToSelector:@selector(window)]) { | 1014 if ([sender respondsToSelector:@selector(window)]) { |
| 1020 id delegate = [[sender window] windowController]; | 1015 id delegate = [[sender window] windowController]; |
| 1021 if ([delegate respondsToSelector:@selector(commandDispatch:)]) { | 1016 if ([delegate respondsToSelector:@selector(commandDispatch:)]) { |
| 1022 [delegate commandDispatch:sender]; | 1017 [delegate commandDispatch:sender]; |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 | 1694 |
| 1700 //--------------------------------------------------------------------------- | 1695 //--------------------------------------------------------------------------- |
| 1701 | 1696 |
| 1702 namespace app_controller_mac { | 1697 namespace app_controller_mac { |
| 1703 | 1698 |
| 1704 bool IsOpeningNewWindow() { | 1699 bool IsOpeningNewWindow() { |
| 1705 return g_is_opening_new_window; | 1700 return g_is_opening_new_window; |
| 1706 } | 1701 } |
| 1707 | 1702 |
| 1708 } // namespace app_controller_mac | 1703 } // namespace app_controller_mac |
| OLD | NEW |