| 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_application_mac.h" | 5 #import "chrome_application_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 @interface CrApplication () | 9 @interface CrApplication () |
| 10 @property(readwrite, | 10 @property(readwrite, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 NSApplication* app = [super sharedApplication]; | 22 NSApplication* app = [super sharedApplication]; |
| 23 if (![NSApp isKindOfClass:self]) { | 23 if (![NSApp isKindOfClass:self]) { |
| 24 LOG(ERROR) << "NSApp should be of type " << [[self className] UTF8String] | 24 LOG(ERROR) << "NSApp should be of type " << [[self className] UTF8String] |
| 25 << ", not " << [[NSApp className] UTF8String]; | 25 << ", not " << [[NSApp className] UTF8String]; |
| 26 DCHECK(false) << "NSApp is of wrong type"; | 26 DCHECK(false) << "NSApp is of wrong type"; |
| 27 } | 27 } |
| 28 return app; | 28 return app; |
| 29 } | 29 } |
| 30 | 30 |
| 31 - (void)sendEvent:(NSEvent*)event { | 31 - (void)sendEvent:(NSEvent*)event { |
| 32 chrome_application_mac::ScopedSendingEvent sendingEventScoper(self); | 32 chrome_application_mac::ScopedSendingEvent sendingEventScoper; |
| 33 [super sendEvent:event]; | 33 [super sendEvent:event]; |
| 34 } | 34 } |
| 35 | 35 |
| 36 @end | 36 @end |
| 37 | 37 |
| 38 namespace chrome_application_mac { | 38 namespace chrome_application_mac { |
| 39 | 39 |
| 40 ScopedSendingEvent::ScopedSendingEvent(CrApplication* app) : app_(app) { | 40 ScopedSendingEvent::ScopedSendingEvent() |
| 41 handling_ = [app_ isHandlingSendEvent]; | 41 : app_(static_cast<CrApplication*>([CrApplication sharedApplication])), |
| 42 handling_([app_ isHandlingSendEvent]) { |
| 42 [app_ setHandlingSendEvent:YES]; | 43 [app_ setHandlingSendEvent:YES]; |
| 43 } | 44 } |
| 44 | 45 |
| 45 ScopedSendingEvent::~ScopedSendingEvent() { | 46 ScopedSendingEvent::~ScopedSendingEvent() { |
| 46 [app_ setHandlingSendEvent:handling_]; | 47 [app_ setHandlingSendEvent:handling_]; |
| 47 } | 48 } |
| 48 | 49 |
| 49 } // namespace chrome_application_mac | 50 } // namespace chrome_application_mac |
| OLD | NEW |