| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_browser_application_mac.h" | 5 #import "chrome/browser/chrome_browser_application_mac.h" |
| 6 | 6 |
| 7 #import "base/auto_reset.h" | 7 #import "base/auto_reset.h" |
| 8 #import "base/logging.h" | 8 #import "base/logging.h" |
| 9 #include "base/mac/crash_logging.h" | 9 #include "base/mac/crash_logging.h" |
| 10 #import "base/mac/scoped_nsexception_enabler.h" | 10 #import "base/mac/scoped_nsexception_enabler.h" |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 424 |
| 425 - (BOOL)isHandlingSendEvent { | 425 - (BOOL)isHandlingSendEvent { |
| 426 return handlingSendEvent_; | 426 return handlingSendEvent_; |
| 427 } | 427 } |
| 428 | 428 |
| 429 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent { | 429 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent { |
| 430 handlingSendEvent_ = handlingSendEvent; | 430 handlingSendEvent_ = handlingSendEvent; |
| 431 } | 431 } |
| 432 | 432 |
| 433 - (void)sendEvent:(NSEvent*)event { | 433 - (void)sendEvent:(NSEvent*)event { |
| 434 // TODO(shess): Squirrel away some info to direct debugging. | |
| 435 // Current hypothesis is that it's a keyboard accelerator. | |
| 436 // http://crbug.com/154483 | |
| 437 static NSString* const kSendEventKey = @"sendevent"; | |
| 438 // For NSEventType 28, recursive -description causes a crash. | |
| 439 // Not much to be done, that type is undocumented. | |
| 440 NSString* value = [event type] == 28 ? @"type=28" : [event description]; | |
| 441 base::mac::ScopedCrashKey key(kSendEventKey, value); | |
| 442 | |
| 443 base::mac::ScopedSendingEvent sendingEventScoper; | 434 base::mac::ScopedSendingEvent sendingEventScoper; |
| 444 for (id<CrApplicationEventHookProtocol> handler in eventHooks_.get()) { | 435 for (id<CrApplicationEventHookProtocol> handler in eventHooks_.get()) { |
| 445 [handler hookForEvent:event]; | 436 [handler hookForEvent:event]; |
| 446 } | 437 } |
| 447 [super sendEvent:event]; | 438 [super sendEvent:event]; |
| 448 } | 439 } |
| 449 | 440 |
| 450 // NSExceptions which are caught by the event loop are logged here. | 441 // NSExceptions which are caught by the event loop are logged here. |
| 451 // NSException uses setjmp/longjmp, which can be very bad for C++, so | 442 // NSException uses setjmp/longjmp, which can be very bad for C++, so |
| 452 // we attempt to track and report them. | 443 // we attempt to track and report them. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 std::vector<NSWindow*>::iterator window_iterator = | 575 std::vector<NSWindow*>::iterator window_iterator = |
| 585 std::find(previousKeyWindows_.begin(), | 576 std::find(previousKeyWindows_.begin(), |
| 586 previousKeyWindows_.end(), | 577 previousKeyWindows_.end(), |
| 587 window); | 578 window); |
| 588 if (window_iterator != previousKeyWindows_.end()) { | 579 if (window_iterator != previousKeyWindows_.end()) { |
| 589 previousKeyWindows_.erase(window_iterator); | 580 previousKeyWindows_.erase(window_iterator); |
| 590 } | 581 } |
| 591 } | 582 } |
| 592 | 583 |
| 593 @end | 584 @end |
| OLD | NEW |