| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 Profile* original_profile = browser->profile()->GetOriginalProfile(); | 171 Profile* original_profile = browser->profile()->GetOriginalProfile(); |
| 172 [AppController updateSigninItem:item | 172 [AppController updateSigninItem:item |
| 173 shouldShow:enable | 173 shouldShow:enable |
| 174 currentProfile:original_profile]; | 174 currentProfile:original_profile]; |
| 175 break; | 175 break; |
| 176 } | 176 } |
| 177 case IDC_BOOKMARK_PAGE: { | 177 case IDC_BOOKMARK_PAGE: { |
| 178 // Extensions have the ability to hide the bookmark page menu item. | 178 // Extensions have the ability to hide the bookmark page menu item. |
| 179 // This only affects the bookmark page menu item under the main menu. | 179 // This only affects the bookmark page menu item under the main menu. |
| 180 // The bookmark page menu item under the wrench menu has its | 180 // The bookmark page menu item under the wrench menu has its |
| 181 // visibility controlled by WrenchMenuModel. | 181 // visibility controlled by AppMenuModel. |
| 182 bool shouldHide = | 182 bool shouldHide = |
| 183 chrome::ShouldRemoveBookmarkThisPageUI(browser->profile()); | 183 chrome::ShouldRemoveBookmarkThisPageUI(browser->profile()); |
| 184 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); | 184 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
| 185 [menuItem setHidden:shouldHide]; | 185 [menuItem setHidden:shouldHide]; |
| 186 break; | 186 break; |
| 187 } | 187 } |
| 188 case IDC_BOOKMARK_ALL_TABS: { | 188 case IDC_BOOKMARK_ALL_TABS: { |
| 189 // Extensions have the ability to hide the bookmark all tabs menu | 189 // Extensions have the ability to hide the bookmark all tabs menu |
| 190 // item. This only affects the bookmark page menu item under the main | 190 // item. This only affects the bookmark page menu item under the main |
| 191 // menu. The bookmark page menu item under the wrench menu has its | 191 // menu. The bookmark page menu item under the wrench menu has its |
| 192 // visibility controlled by WrenchMenuModel. | 192 // visibility controlled by AppMenuModel. |
| 193 bool shouldHide = | 193 bool shouldHide = |
| 194 chrome::ShouldRemoveBookmarkOpenPagesUI(browser->profile()); | 194 chrome::ShouldRemoveBookmarkOpenPagesUI(browser->profile()); |
| 195 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); | 195 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
| 196 [menuItem setHidden:shouldHide]; | 196 [menuItem setHidden:shouldHide]; |
| 197 break; | 197 break; |
| 198 } | 198 } |
| 199 default: | 199 default: |
| 200 // Special handling for the contents of the Text Encoding submenu. On | 200 // Special handling for the contents of the Text Encoding submenu. On |
| 201 // Mac OS, instead of enabling/disabling the top-level menu item, we | 201 // Mac OS, instead of enabling/disabling the top-level menu item, we |
| 202 // enable/disable the submenu's contents (per Apple's HIG). | 202 // enable/disable the submenu's contents (per Apple's HIG). |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // the background" in this case. | 242 // the background" in this case. |
| 243 modifierFlags &= ~NSCommandKeyMask; | 243 modifierFlags &= ~NSCommandKeyMask; |
| 244 } | 244 } |
| 245 chrome::ExecuteCommandWithDisposition( | 245 chrome::ExecuteCommandWithDisposition( |
| 246 FindBrowserForSender(sender, window), command, | 246 FindBrowserForSender(sender, window), command, |
| 247 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], | 247 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], |
| 248 modifierFlags)); | 248 modifierFlags)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 @end | 251 @end |
| OLD | NEW |