| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/app_shim_menu_controller_mac.h" | 5 #import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h" |
| 6 | 6 |
| 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
| 8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
| 9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 [appMenu addItem:[hideDoppelganger_ menuItem]]; | 230 [appMenu addItem:[hideDoppelganger_ menuItem]]; |
| 231 [appMenu addItem:[NSMenuItem separatorItem]]; | 231 [appMenu addItem:[NSMenuItem separatorItem]]; |
| 232 [appMenu addItem:[quitDoppelganger_ menuItem]]; | 232 [appMenu addItem:[quitDoppelganger_ menuItem]]; |
| 233 | 233 |
| 234 // File menu. | 234 // File menu. |
| 235 fileMenuItem_.reset([NewTopLevelItemFrom(IDC_FILE_MENU) retain]); | 235 fileMenuItem_.reset([NewTopLevelItemFrom(IDC_FILE_MENU) retain]); |
| 236 [[fileMenuItem_ submenu] addItem:[newDoppelganger_ menuItem]]; | 236 [[fileMenuItem_ submenu] addItem:[newDoppelganger_ menuItem]]; |
| 237 [[fileMenuItem_ submenu] addItem:[openDoppelganger_ menuItem]]; | 237 [[fileMenuItem_ submenu] addItem:[openDoppelganger_ menuItem]]; |
| 238 [[fileMenuItem_ submenu] addItem:[NSMenuItem separatorItem]]; | 238 [[fileMenuItem_ submenu] addItem:[NSMenuItem separatorItem]]; |
| 239 AddDuplicateItem(fileMenuItem_, IDC_FILE_MENU, IDC_CLOSE_WINDOW); | 239 AddDuplicateItem(fileMenuItem_, IDC_FILE_MENU, IDC_CLOSE_WINDOW); |
| 240 // Set the expected key equivalent explicitly here because |
| 241 // -[AppControllerMac adjustCloseWindowMenuItemKeyEquivalent:] sets it to |
| 242 // "W" (Cmd+Shift+w) when a tabbed window has focus; it will change it back |
| 243 // to Cmd+w when a non-tabbed window has focus. |
| 244 [[[fileMenuItem_ submenu] itemWithTag:IDC_CLOSE_WINDOW] |
| 245 setKeyEquivalent:@"w"]; |
| 240 | 246 |
| 241 // Edit menu. This copies the menu entirely and removes | 247 // Edit menu. This copies the menu entirely and removes |
| 242 // "Paste and Match Style" and "Find". This is because the last two items, | 248 // "Paste and Match Style" and "Find". This is because the last two items, |
| 243 // "Start Dictation" and "Special Characters" are added by OSX, so we can't | 249 // "Start Dictation" and "Special Characters" are added by OSX, so we can't |
| 244 // copy them explicitly. | 250 // copy them explicitly. |
| 245 editMenuItem_.reset([[[NSApp mainMenu] itemWithTag:IDC_EDIT_MENU] copy]); | 251 editMenuItem_.reset([[[NSApp mainMenu] itemWithTag:IDC_EDIT_MENU] copy]); |
| 246 NSMenu* editMenu = [editMenuItem_ submenu]; | 252 NSMenu* editMenu = [editMenuItem_ submenu]; |
| 247 [editMenu removeItem:[editMenu | 253 [editMenu removeItem:[editMenu |
| 248 itemWithTag:IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE]]; | 254 itemWithTag:IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE]]; |
| 249 [editMenu removeItem:[editMenu itemWithTag:IDC_FIND_MENU]]; | 255 [editMenu removeItem:[editMenu itemWithTag:IDC_FIND_MENU]]; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 373 |
| 368 - (void)focusCurrentPlatformApp { | 374 - (void)focusCurrentPlatformApp { |
| 369 apps::ShellWindow* shellWindow = | 375 apps::ShellWindow* shellWindow = |
| 370 apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile( | 376 apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile( |
| 371 [NSApp keyWindow]); | 377 [NSApp keyWindow]); |
| 372 if (shellWindow) | 378 if (shellWindow) |
| 373 apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow); | 379 apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow); |
| 374 } | 380 } |
| 375 | 381 |
| 376 @end | 382 @end |
| OLD | NEW |