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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 } | 222 } |
223 case IDC_SHOW_AS_TAB: { | |
224 // Hide this menu option if the window is tabbed. | |
225 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); | |
226 [menuItem setHidden:browser->is_type_tabbed()]; | |
erikchen
2016/02/10 03:13:13
Missing break for this case, and the one above it?
spqchan
2016/02/10 17:27:06
Done.
| |
227 } | |
223 default: | 228 default: |
224 // Special handling for the contents of the Text Encoding submenu. On | 229 // Special handling for the contents of the Text Encoding submenu. On |
225 // Mac OS, instead of enabling/disabling the top-level menu item, we | 230 // Mac OS, instead of enabling/disabling the top-level menu item, we |
226 // enable/disable the submenu's contents (per Apple's HIG). | 231 // enable/disable the submenu's contents (per Apple's HIG). |
227 EncodingMenuController encoding_controller; | 232 EncodingMenuController encoding_controller; |
228 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) | 233 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) |
229 enable &= chrome::IsCommandEnabled(browser, IDC_ENCODING_MENU); | 234 enable &= chrome::IsCommandEnabled(browser, IDC_ENCODING_MENU); |
230 } | 235 } |
231 | 236 |
232 // If the item is toggleable, find its toggle state and | 237 // If the item is toggleable, find its toggle state and |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 // the background" in this case. | 271 // the background" in this case. |
267 modifierFlags &= ~NSCommandKeyMask; | 272 modifierFlags &= ~NSCommandKeyMask; |
268 } | 273 } |
269 chrome::ExecuteCommandWithDisposition( | 274 chrome::ExecuteCommandWithDisposition( |
270 FindBrowserForSender(sender, window), command, | 275 FindBrowserForSender(sender, window), command, |
271 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], | 276 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], |
272 modifierFlags)); | 277 modifierFlags)); |
273 } | 278 } |
274 | 279 |
275 @end | 280 @end |
OLD | NEW |