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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 9230011: Better fix for Lion dictionary popover cmd-W bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
OLDNEW
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/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 965
966 - (BOOL)supportsFullscreen { 966 - (BOOL)supportsFullscreen {
967 // TODO(avi, thakis): GTMWindowSheetController has no api to move 967 // TODO(avi, thakis): GTMWindowSheetController has no api to move
968 // tabsheets between windows. Until then, we have to prevent having to 968 // tabsheets between windows. Until then, we have to prevent having to
969 // move a tabsheet between windows, e.g. no fullscreen toggling 969 // move a tabsheet between windows, e.g. no fullscreen toggling
970 NSArray* a = [[tabStripController_ sheetController] viewsWithAttachedSheets]; 970 NSArray* a = [[tabStripController_ sheetController] viewsWithAttachedSheets];
971 return [a count] == 0; 971 return [a count] == 0;
972 } 972 }
973 973
974 // Called to validate menu and toolbar items when this window is key. All the 974 // Called to validate menu and toolbar items when this window is key. All the
975 // items we care about have been set with the -performClose:, -commandDispatch: 975 // items we care about have been set with the |-commandDispatch:| or
976 // or -commandDispatchUsingKeyModifiers: actions and a target of FirstResponder 976 // |-commandDispatchUsingKeyModifiers:| actions and a target of FirstResponder
977 // in IB. If it's not one of those, let it continue up the responder chain to be 977 // in IB. If it's not one of those, let it continue up the responder chain to be
978 // handled elsewhere. We pull out the tag as the cross-platform constant to 978 // handled elsewhere. We pull out the tag as the cross-platform constant to
979 // differentiate and dispatch the various commands. 979 // differentiate and dispatch the various commands.
980 // NOTE: we might have to handle state for app-wide menu items, 980 // NOTE: we might have to handle state for app-wide menu items,
981 // although we could cheat and directly ask the app controller if our 981 // although we could cheat and directly ask the app controller if our
982 // command_updater doesn't support the command. This may or may not be an issue, 982 // command_updater doesn't support the command. This may or may not be an issue,
983 // too early to tell. 983 // too early to tell.
984 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 984 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
985 SEL action = [item action]; 985 SEL action = [item action];
986 BOOL enable = NO; 986 BOOL enable = NO;
987 if (action == @selector(performClose:) || 987 if (action == @selector(commandDispatch:) ||
988 action == @selector(commandDispatch:) ||
989 action == @selector(commandDispatchUsingKeyModifiers:)) { 988 action == @selector(commandDispatchUsingKeyModifiers:)) {
990 NSInteger tag = [item tag]; 989 NSInteger tag = [item tag];
991 if (browser_->command_updater()->SupportsCommand(tag)) { 990 if (browser_->command_updater()->SupportsCommand(tag)) {
992 // Generate return value (enabled state) 991 // Generate return value (enabled state)
993 enable = browser_->command_updater()->IsCommandEnabled(tag); 992 enable = browser_->command_updater()->IsCommandEnabled(tag);
994 switch (tag) { 993 switch (tag) {
995 case IDC_CLOSE_TAB: 994 case IDC_CLOSE_TAB:
996 // Disable "close tab" if the receiving window is not tabbed. 995 // Disable "close tab" if the receiving window is not tabbed.
997 // We simply check whether the item has a keyboard shortcut set here; 996 // We simply check whether the item has a keyboard shortcut set here;
998 // app_controller_mac.mm actually determines whether the item should 997 // app_controller_mac.mm actually determines whether the item should
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 2163
2165 - (BOOL)supportsBookmarkBar { 2164 - (BOOL)supportsBookmarkBar {
2166 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2165 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2167 } 2166 }
2168 2167
2169 - (BOOL)isTabbedWindow { 2168 - (BOOL)isTabbedWindow {
2170 return browser_->is_type_tabbed(); 2169 return browser_->is_type_tabbed();
2171 } 2170 }
2172 2171
2173 @end // @implementation BrowserWindowController(WindowType) 2172 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/chrome_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698