| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // app_controller_mac.mm actually determines whether the item should | 126 // app_controller_mac.mm actually determines whether the item should |
| 127 // be enabled. | 127 // be enabled. |
| 128 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) | 128 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) |
| 129 enable &= !![[menuItem keyEquivalent] length]; | 129 enable &= !![[menuItem keyEquivalent] length]; |
| 130 break; | 130 break; |
| 131 case IDC_FULLSCREEN: { | 131 case IDC_FULLSCREEN: { |
| 132 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) | 132 if (NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item)) |
| 133 [menuItem setTitle:GetTitleForFullscreenMenuItem(browser)]; | 133 [menuItem setTitle:GetTitleForFullscreenMenuItem(browser)]; |
| 134 break; | 134 break; |
| 135 } | 135 } |
| 136 case IDC_SHOW_SIGNIN: { | |
| 137 Profile* original_profile = browser->profile()->GetOriginalProfile(); | |
| 138 [AppController updateSigninItem:item | |
| 139 shouldShow:enable | |
| 140 currentProfile:original_profile]; | |
| 141 content::RecordAction( | |
| 142 base::UserMetricsAction("Signin_Impression_FromMenu")); | |
| 143 break; | |
| 144 } | |
| 145 case IDC_BOOKMARK_PAGE: { | 136 case IDC_BOOKMARK_PAGE: { |
| 146 // Extensions have the ability to hide the bookmark page menu item. | 137 // Extensions have the ability to hide the bookmark page menu item. |
| 147 // This only affects the bookmark page menu item under the main menu. | 138 // This only affects the bookmark page menu item under the main menu. |
| 148 // The bookmark page menu item under the app menu has its visibility | 139 // The bookmark page menu item under the app menu has its visibility |
| 149 // controlled by AppMenuModel. | 140 // controlled by AppMenuModel. |
| 150 bool shouldHide = | 141 bool shouldHide = |
| 151 chrome::ShouldRemoveBookmarkThisPageUI(browser->profile()); | 142 chrome::ShouldRemoveBookmarkThisPageUI(browser->profile()); |
| 152 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); | 143 NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); |
| 153 [menuItem setHidden:shouldHide]; | 144 [menuItem setHidden:shouldHide]; |
| 154 break; | 145 break; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // the background" in this case. | 203 // the background" in this case. |
| 213 modifierFlags &= ~NSCommandKeyMask; | 204 modifierFlags &= ~NSCommandKeyMask; |
| 214 } | 205 } |
| 215 chrome::ExecuteCommandWithDisposition( | 206 chrome::ExecuteCommandWithDisposition( |
| 216 FindBrowserForSender(sender, window), command, | 207 FindBrowserForSender(sender, window), command, |
| 217 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], | 208 ui::WindowOpenDispositionFromNSEventWithFlags([NSApp currentEvent], |
| 218 modifierFlags)); | 209 modifierFlags)); |
| 219 } | 210 } |
| 220 | 211 |
| 221 @end | 212 @end |
| OLD | NEW |