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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_utils.mm

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_utils.h" 5 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // Look in menu. 60 // Look in menu.
61 NSMenuItem* item = [MenuWalker itemForKeyEquivalent:event.os_event 61 NSMenuItem* item = [MenuWalker itemForKeyEquivalent:event.os_event
62 menu:[NSApp mainMenu]]; 62 menu:[NSApp mainMenu]];
63 63
64 if (item && [item action] == @selector(commandDispatch:) && [item tag] > 0) 64 if (item && [item action] == @selector(commandDispatch:) && [item tag] > 0)
65 return [item tag]; 65 return [item tag];
66 66
67 // "Close window" doesn't use the |commandDispatch:| mechanism. Menu items 67 // "Close window" doesn't use the |commandDispatch:| mechanism. Menu items
68 // that do not correspond to IDC_ constants need no special treatment however, 68 // that do not correspond to IDC_ constants need no special treatment however,
69 // as they can't be blacklisted in |Browser::IsReservedCommandOrKey()| anyhow. 69 // as they can't be blacklisted in
70 // |BrowserCommandController::IsReservedCommandOrKey()| anyhow.
70 if (item && [item action] == @selector(performClose:)) 71 if (item && [item action] == @selector(performClose:))
71 return IDC_CLOSE_WINDOW; 72 return IDC_CLOSE_WINDOW;
72 73
73 // "Exit" doesn't use the |commandDispatch:| mechanism either. 74 // "Exit" doesn't use the |commandDispatch:| mechanism either.
74 if (item && [item action] == @selector(terminate:)) 75 if (item && [item action] == @selector(terminate:))
75 return IDC_EXIT; 76 return IDC_EXIT;
76 77
77 // Look in secondary keyboard shortcuts. 78 // Look in secondary keyboard shortcuts.
78 NSUInteger modifiers = [event.os_event modifierFlags]; 79 NSUInteger modifiers = [event.os_event modifierFlags];
79 const bool cmdKey = (modifiers & NSCommandKeyMask) != 0; 80 const bool cmdKey = (modifiers & NSCommandKeyMask) != 0;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 + (void)activateWindowForController:(NSWindowController*)controller { 183 + (void)activateWindowForController:(NSWindowController*)controller {
183 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to 184 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to
184 // properly activate windows if Chrome is not the active application. 185 // properly activate windows if Chrome is not the active application.
185 [[controller window] makeKeyAndOrderFront:controller]; 186 [[controller window] makeKeyAndOrderFront:controller];
186 ProcessSerialNumber psn; 187 ProcessSerialNumber psn;
187 GetCurrentProcess(&psn); 188 GetCurrentProcess(&psn);
188 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly); 189 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
189 } 190 }
190 191
191 @end 192 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/command_observer_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698