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

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

Issue 1248183004: [Mac] added support for show as tab on popups, similar behavior that exists in windows in which rep… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « chrome/app/nibs/MainMenu.xib ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 1115 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
1116 SEL action = [item action]; 1116 SEL action = [item action];
1117 BOOL enable = NO; 1117 BOOL enable = NO;
1118 if (action == @selector(commandDispatch:) || 1118 if (action == @selector(commandDispatch:) ||
1119 action == @selector(commandDispatchUsingKeyModifiers:)) { 1119 action == @selector(commandDispatchUsingKeyModifiers:)) {
1120 NSInteger tag = [item tag]; 1120 NSInteger tag = [item tag];
1121 if (chrome::SupportsCommand(browser_.get(), tag)) { 1121 if (chrome::SupportsCommand(browser_.get(), tag)) {
1122 // Generate return value (enabled state) 1122 // Generate return value (enabled state)
1123 enable = chrome::IsCommandEnabled(browser_.get(), tag); 1123 enable = chrome::IsCommandEnabled(browser_.get(), tag);
1124 switch (tag) { 1124 switch (tag) {
1125 case IDC_SHOW_AS_TAB:
1126 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) {
1127 bool shouldHide = browser_->is_type_tabbed();
1128 [menuItem setHidden:shouldHide];
1129 }
1130 break;
1131 case IDC_NEW_TAB:
1132 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) {
1133 bool shouldHide = !browser_->is_type_tabbed();
1134 [menuItem setHidden:shouldHide];
1135 }
1136 break;
1125 case IDC_CLOSE_TAB: 1137 case IDC_CLOSE_TAB:
1126 // Disable "close tab" if the receiving window is not tabbed. 1138 // Disable "close tab" if the receiving window is not tabbed.
1127 // We simply check whether the item has a keyboard shortcut set here; 1139 // We simply check whether the item has a keyboard shortcut set here;
1128 // app_controller_mac.mm actually determines whether the item should 1140 // app_controller_mac.mm actually determines whether the item should
1129 // be enabled. 1141 // be enabled.
1130 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) 1142 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item))
1131 enable &= !![[menuItem keyEquivalent] length]; 1143 enable &= !![[menuItem keyEquivalent] length];
1132 break; 1144 break;
1133 case IDC_FULLSCREEN: { 1145 case IDC_FULLSCREEN: {
1134 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) { 1146 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) {
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 2284
2273 - (BOOL)supportsBookmarkBar { 2285 - (BOOL)supportsBookmarkBar {
2274 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2286 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2275 } 2287 }
2276 2288
2277 - (BOOL)isTabbedWindow { 2289 - (BOOL)isTabbedWindow {
2278 return browser_->is_type_tabbed(); 2290 return browser_->is_type_tabbed();
2279 } 2291 }
2280 2292
2281 @end // @implementation BrowserWindowController(WindowType) 2293 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/app/nibs/MainMenu.xib ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698