Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 12 |
| 12 namespace CrApplicationNSException { | 13 namespace CrApplicationNSException { |
| 13 | 14 |
| 14 // Maximum number of known named exceptions we'll support. There is | 15 // Maximum number of known named exceptions we'll support. There is |
| 15 // no central registration, but I only find about 75 possibilities in | 16 // no central registration, but I only find about 75 possibilities in |
| 16 // the system frameworks, and many of them are probably not | 17 // the system frameworks, and many of them are probably not |
| 17 // interesting to track in aggregate (those relating to distributed | 18 // interesting to track in aggregate (those relating to distributed |
| 18 // objects, for instance). | 19 // objects, for instance). |
| 19 const size_t kKnownNSExceptionCount = 25; | 20 const size_t kKnownNSExceptionCount = 25; |
| 20 | 21 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 | 178 |
| 178 NSString* actionString = NSStringFromSelector(anAction); | 179 NSString* actionString = NSStringFromSelector(anAction); |
| 179 NSString* value = | 180 NSString* value = |
| 180 [NSString stringWithFormat:@"%@ tag %d sending %@ to %p", | 181 [NSString stringWithFormat:@"%@ tag %d sending %@ to %p", |
| 181 [sender className], tag, actionString, aTarget]; | 182 [sender className], tag, actionString, aTarget]; |
| 182 | 183 |
| 183 ScopedCrashKey key(kActionKey, value); | 184 ScopedCrashKey key(kActionKey, value); |
| 184 return [super sendAction:anAction to:aTarget from:sender]; | 185 return [super sendAction:anAction to:aTarget from:sender]; |
| 185 } | 186 } |
| 186 | 187 |
| 188 - (void)sendEvent:(NSEvent*)event { | |
|
Mark Mentovai
2009/10/22 20:44:36
This change may have regressed startup time, but t
| |
| 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 | |
| 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. | |
| 193 if ([event type] == NSKeyDown || [event type] == NSKeyUp) { | |
|
pink (ping after 24hrs)
2009/10/19 15:18:24
I really dislike the app controller having this ki
Nico
2009/10/19 20:06:43
I'm addressing this comment (and more) in http://c
| |
| 194 if ([[[self keyWindow] firstResponder] | |
| 195 isKindOfClass:[RenderWidgetHostViewCocoa class]]) { | |
| 196 // No other mac browser sends keyup() for keyboard equivalents, so let's | |
| 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; | |
| 205 } | |
| 206 } | |
| 207 | |
| 208 [super sendEvent:event]; | |
| 209 } | |
| 210 | |
| 187 // NSExceptions which are caught by the event loop are logged here. | 211 // NSExceptions which are caught by the event loop are logged here. |
| 188 // NSException uses setjmp/longjmp, which can be very bad for C++, so | 212 // NSException uses setjmp/longjmp, which can be very bad for C++, so |
| 189 // we attempt to track and report them. | 213 // we attempt to track and report them. |
| 190 - (void)reportException:(NSException *)anException { | 214 - (void)reportException:(NSException *)anException { |
| 191 // If we throw an exception in this code, we can create an infinite | 215 // If we throw an exception in this code, we can create an infinite |
| 192 // loop. If we throw out of the if() without resetting | 216 // loop. If we throw out of the if() without resetting |
| 193 // |reportException|, we'll stop reporting exceptions for this run. | 217 // |reportException|, we'll stop reporting exceptions for this run. |
| 194 static BOOL reportingException = NO; | 218 static BOOL reportingException = NO; |
| 195 DCHECK(!reportingException); | 219 DCHECK(!reportingException); |
| 196 if (!reportingException) { | 220 if (!reportingException) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 257 |
| 234 @end | 258 @end |
| 235 | 259 |
| 236 namespace CrApplicationCC { | 260 namespace CrApplicationCC { |
| 237 | 261 |
| 238 void Terminate() { | 262 void Terminate() { |
| 239 [NSApp terminate:nil]; | 263 [NSApp terminate:nil]; |
| 240 } | 264 } |
| 241 | 265 |
| 242 } // namespace CrApplicationCC | 266 } // namespace CrApplicationCC |
| OLD | NEW |