Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Side by Side Diff: chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm

Issue 130673002: Explicitly use Cmd+w for "Close Window" in apps. (Mac) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment. Fix line length. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
tapted 2014/01/09 06:54:55 I would say "Set the expected key equivalent expli
jackhou1 2014/01/09 22:44:07 Done. AppControllerMac changes the key equivalent
241 // equivalent is sometimes "W" (Cmd+Shift+w), and "Close Tab" is mapped to
242 // Cmd+W. -[AppControllerMac adjustCloseWindowMenuItemKeyEquivalent:] manages
243 // this and will make "Close Window" have the Cmd+w shortcut when an app
244 // window has focus.
245 [[[fileMenuItem_ submenu] itemWithTag:IDC_CLOSE_WINDOW]
246 setKeyEquivalent:@"w"];
240 247
241 // Edit menu. This copies the menu entirely and removes 248 // Edit menu. This copies the menu entirely and removes
242 // "Paste and Match Style" and "Find". This is because the last two items, 249 // "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 250 // "Start Dictation" and "Special Characters" are added by OSX, so we can't
244 // copy them explicitly. 251 // copy them explicitly.
245 editMenuItem_.reset([[[NSApp mainMenu] itemWithTag:IDC_EDIT_MENU] copy]); 252 editMenuItem_.reset([[[NSApp mainMenu] itemWithTag:IDC_EDIT_MENU] copy]);
246 NSMenu* editMenu = [editMenuItem_ submenu]; 253 NSMenu* editMenu = [editMenuItem_ submenu];
247 [editMenu removeItem:[editMenu 254 [editMenu removeItem:[editMenu
248 itemWithTag:IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE]]; 255 itemWithTag:IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE]];
249 [editMenu removeItem:[editMenu itemWithTag:IDC_FIND_MENU]]; 256 [editMenu removeItem:[editMenu itemWithTag:IDC_FIND_MENU]];
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 374
368 - (void)focusCurrentPlatformApp { 375 - (void)focusCurrentPlatformApp {
369 apps::ShellWindow* shellWindow = 376 apps::ShellWindow* shellWindow =
370 apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile( 377 apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
371 [NSApp keyWindow]); 378 [NSApp keyWindow]);
372 if (shellWindow) 379 if (shellWindow)
373 apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow); 380 apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow);
374 } 381 }
375 382
376 @end 383 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698