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

Side by Side Diff: chrome/browser/chrome_application_mac.mm

Issue 303002: Make window cycling work even if you change it to something else than cmd-` in sysprefs. (Closed)
Patch Set: Fix spelling. Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/chrome_application_mac.h" 5 #import "chrome/browser/chrome_application_mac.h"
6 6
7 #import "base/histogram.h" 7 #import "base/histogram.h"
8 #import "base/logging.h" 8 #import "base/logging.h"
9 #import "base/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
10 #import "chrome/app/breakpad_mac.h" 10 #import "chrome/app/breakpad_mac.h"
11 #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" 11 #import "chrome/browser/cocoa/chrome_event_processing_window.h"
12 12
13 namespace CrApplicationNSException { 13 namespace CrApplicationNSException {
14 14
15 // Maximum number of known named exceptions we'll support. There is 15 // Maximum number of known named exceptions we'll support. There is
16 // no central registration, but I only find about 75 possibilities in 16 // no central registration, but I only find about 75 possibilities in
17 // the system frameworks, and many of them are probably not 17 // the system frameworks, and many of them are probably not
18 // interesting to track in aggregate (those relating to distributed 18 // interesting to track in aggregate (those relating to distributed
19 // objects, for instance). 19 // objects, for instance).
20 const size_t kKnownNSExceptionCount = 25; 20 const size_t kKnownNSExceptionCount = 25;
21 21
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 ScopedCrashKey key(kActionKey, value); 184 ScopedCrashKey key(kActionKey, value);
185 return [super sendAction:anAction to:aTarget from:sender]; 185 return [super sendAction:anAction to:aTarget from:sender];
186 } 186 }
187 187
188 - (void)sendEvent:(NSEvent*)event { 188 - (void)sendEvent:(NSEvent*)event {
189 // The superclass's |sendEvent:| sends keyboard events to the menu and the key 189 // The superclass's |sendEvent:| sends keyboard events to the menu and the key
190 // view loop before dispatching them to |keyDown:|. Since we want to send keys 190 // view loop before dispatching them to |keyDown:|. Since we want to send keys
191 // to the renderer before sending them to the menu, and we never want them to 191 // to the renderer before sending them to the menu, and we never want them to
192 // the kev view loop when the web is focussed, we change this behavior. 192 // the kev view loop when the web is focussed, we change this behavior.
193 if ([event type] == NSKeyDown || [event type] == NSKeyUp) { 193 if ([[self keyWindow]
194 if ([[[self keyWindow] firstResponder] 194 isKindOfClass:[ChromeEventProcessingWindow class]]) {
195 isKindOfClass:[RenderWidgetHostViewCocoa class]]) { 195 if ([static_cast<ChromeEventProcessingWindow*>([self keyWindow])
196 // No other mac browser sends keyup() for keyboard equivalents, so let's 196 shortcircuitEvent:event])
197 // suppress this.
198 if (([event modifierFlags] & NSCommandKeyMask) && [event type] == NSKeyUp)
199 return;
200
201 RenderWidgetHostViewCocoa* rwhv = static_cast<RenderWidgetHostViewCocoa*>(
202 [[self keyWindow] firstResponder]);
203 [rwhv keyEvent:event];
204 return; 197 return;
205 }
206 } 198 }
207 199
208 [super sendEvent:event]; 200 [super sendEvent:event];
209 } 201 }
210 202
211 // NSExceptions which are caught by the event loop are logged here. 203 // NSExceptions which are caught by the event loop are logged here.
212 // NSException uses setjmp/longjmp, which can be very bad for C++, so 204 // NSException uses setjmp/longjmp, which can be very bad for C++, so
213 // we attempt to track and report them. 205 // we attempt to track and report them.
214 - (void)reportException:(NSException *)anException { 206 - (void)reportException:(NSException *)anException {
215 // If we throw an exception in this code, we can create an infinite 207 // If we throw an exception in this code, we can create an infinite
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 249
258 @end 250 @end
259 251
260 namespace CrApplicationCC { 252 namespace CrApplicationCC {
261 253
262 void Terminate() { 254 void Terminate() {
263 [NSApp terminate:nil]; 255 [NSApp terminate:nil];
264 } 256 }
265 257
266 } // namespace CrApplicationCC 258 } // namespace CrApplicationCC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698