OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_command_handler.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_command_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); | 212 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
213 [menuItem setHidden:shouldHide]; | 213 [menuItem setHidden:shouldHide]; |
214 break; | 214 break; |
215 } | 215 } |
216 case IDC_TOGGLE_FULLSCREEN_TOOLBAR: { | 216 case IDC_TOGGLE_FULLSCREEN_TOOLBAR: { |
217 if (!chrome::mac::SupportsSystemFullscreen()) { | 217 if (!chrome::mac::SupportsSystemFullscreen()) { |
218 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); | 218 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
219 [menuItem setHidden:YES]; | 219 [menuItem setHidden:YES]; |
220 enable = NO; | 220 enable = NO; |
221 } | 221 } |
| 222 break; |
| 223 } |
| 224 case IDC_SHOW_AS_TAB: { |
| 225 // Hide this menu option if the window is tabbed. |
| 226 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
| 227 [menuItem setHidden:browser->is_type_tabbed()]; |
| 228 break; |
222 } | 229 } |
223 default: | 230 default: |
224 // Special handling for the contents of the Text Encoding submenu. On | 231 // Special handling for the contents of the Text Encoding submenu. On |
225 // Mac OS, instead of enabling/disabling the top-level menu item, we | 232 // Mac OS, instead of enabling/disabling the top-level menu item, we |
226 // enable/disable the submenu's contents (per Apple's HIG). | 233 // enable/disable the submenu's contents (per Apple's HIG). |
227 EncodingMenuController encoding_controller; | 234 EncodingMenuController encoding_controller; |
228 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) | 235 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) |
229 enable &= chrome::IsCommandEnabled(browser, IDC_ENCODING_MENU); | 236 enable &= chrome::IsCommandEnabled(browser, IDC_ENCODING_MENU); |
230 } | 237 } |
231 | 238 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // the background" in this case. | 273 // the background" in this case. |
267 modifierFlags &= ~NSCommandKeyMask; | 274 modifierFlags &= ~NSCommandKeyMask; |
268 } | 275 } |
269 chrome::ExecuteCommandWithDisposition( | 276 chrome::ExecuteCommandWithDisposition( |
270 FindBrowserForSender(sender, window), command, | 277 FindBrowserForSender(sender, window), command, |
271 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], | 278 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], |
272 modifierFlags)); | 279 modifierFlags)); |
273 } | 280 } |
274 | 281 |
275 @end | 282 @end |
OLD | NEW |