OLD | NEW |
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 27 matching lines...) Expand all Loading... |
38 if ([event type] == NSKeyDown) { | 38 if ([event type] == NSKeyDown) { |
39 // Send the event to the menu before sending it to the browser/window | 39 // Send the event to the menu before sending it to the browser/window |
40 // shortcut handling, so that if a user configures cmd-left to mean | 40 // shortcut handling, so that if a user configures cmd-left to mean |
41 // "previous tab", it takes precedence over the built-in "history back" | 41 // "previous tab", it takes precedence over the built-in "history back" |
42 // binding. Other than that, the |-redispatchKeyEvent:| call would take care | 42 // binding. Other than that, the |-redispatchKeyEvent:| call would take care |
43 // of invoking the original menu item shortcut as well. | 43 // of invoking the original menu item shortcut as well. |
44 | 44 |
45 if ([[NSApp mainMenu] performKeyEquivalent:event]) | 45 if ([[NSApp mainMenu] performKeyEquivalent:event]) |
46 return true; | 46 return true; |
47 | 47 |
48 if ([event_window handleExtraBrowserKeyboardShortcut:event]) | 48 if ([event_window handleExtraKeyboardShortcut:event]) |
49 return true; | |
50 | |
51 if ([event_window handleExtraWindowKeyboardShortcut:event]) | |
52 return true; | |
53 | |
54 if ([event_window handleDelayedWindowKeyboardShortcut:event]) | |
55 return true; | 49 return true; |
56 } | 50 } |
57 | 51 |
58 return [event_window redispatchKeyEvent:event]; | 52 return [event_window redispatchKeyEvent:event]; |
59 } | 53 } |
60 | 54 |
61 + (NSString*)scheduleReplaceOldTitle:(NSString*)oldTitle | 55 + (NSString*)scheduleReplaceOldTitle:(NSString*)oldTitle |
62 withNewTitle:(NSString*)newTitle | 56 withNewTitle:(NSString*)newTitle |
63 forWindow:(NSWindow*)window { | 57 forWindow:(NSWindow*)window { |
64 if (oldTitle) | 58 if (oldTitle) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 + (void)activateWindowForController:(NSWindowController*)controller { | 126 + (void)activateWindowForController:(NSWindowController*)controller { |
133 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to | 127 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to |
134 // properly activate windows if Chrome is not the active application. | 128 // properly activate windows if Chrome is not the active application. |
135 [[controller window] makeKeyAndOrderFront:controller]; | 129 [[controller window] makeKeyAndOrderFront:controller]; |
136 ProcessSerialNumber psn; | 130 ProcessSerialNumber psn; |
137 GetCurrentProcess(&psn); | 131 GetCurrentProcess(&psn); |
138 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly); | 132 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly); |
139 } | 133 } |
140 | 134 |
141 @end | 135 @end |
OLD | NEW |