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 Chrome's key | |
241 // equivalent is sometimes "W" (Cmd+Shift+W), and "Close Tab" is mapped to | |
242 // Cmd+W. | |
243 [[[fileMenuItem_ submenu] itemWithTag:IDC_CLOSE_WINDOW] setKeyEquivalent:@"w"] ; | |
tapted
2014/01/09 04:35:05
Do you need to hook this up in something like [Dop
jackhou1
2014/01/09 06:18:57
I don't think so. "Close Window" will be Cmd+w whe
| |
240 | 244 |
241 // Edit menu. This copies the menu entirely and removes | 245 // Edit menu. This copies the menu entirely and removes |
242 // "Paste and Match Style" and "Find". This is because the last two items, | 246 // "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 | 247 // "Start Dictation" and "Special Characters" are added by OSX, so we can't |
244 // copy them explicitly. | 248 // copy them explicitly. |
245 editMenuItem_.reset([[[NSApp mainMenu] itemWithTag:IDC_EDIT_MENU] copy]); | 249 editMenuItem_.reset([[[NSApp mainMenu] itemWithTag:IDC_EDIT_MENU] copy]); |
246 NSMenu* editMenu = [editMenuItem_ submenu]; | 250 NSMenu* editMenu = [editMenuItem_ submenu]; |
247 [editMenu removeItem:[editMenu | 251 [editMenu removeItem:[editMenu |
248 itemWithTag:IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE]]; | 252 itemWithTag:IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE]]; |
249 [editMenu removeItem:[editMenu itemWithTag:IDC_FIND_MENU]]; | 253 [editMenu removeItem:[editMenu itemWithTag:IDC_FIND_MENU]]; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 | 371 |
368 - (void)focusCurrentPlatformApp { | 372 - (void)focusCurrentPlatformApp { |
369 apps::ShellWindow* shellWindow = | 373 apps::ShellWindow* shellWindow = |
370 apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile( | 374 apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile( |
371 [NSApp keyWindow]); | 375 [NSApp keyWindow]); |
372 if (shellWindow) | 376 if (shellWindow) |
373 apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow); | 377 apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow); |
374 } | 378 } |
375 | 379 |
376 @end | 380 @end |
OLD | NEW |