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

Side by Side Diff: base/chrome_application_mac.mm

Issue 385009: [Mac] ScopedSendingEvent finds NSApp by itself. (Closed)
Patch Set: Created 11 years, 1 month 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
« no previous file with comments | « base/chrome_application_mac.h ('k') | chrome/browser/tab_contents/tab_contents_view_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
OLDNEW
« no previous file with comments | « base/chrome_application_mac.h ('k') | chrome/browser/tab_contents/tab_contents_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698