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

Side by Side Diff: content/common/chrome_application_mac.h

Issue 8498034: [Mac] Move event hooks from CrApplication to BrowserCrApplication. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: And copyright, sigh. Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CONTENT_COMMON_CHROME_APPLICATION_MAC_H_ 5 #ifndef CONTENT_COMMON_CHROME_APPLICATION_MAC_H_
6 #define CONTENT_COMMON_CHROME_APPLICATION_MAC_H_ 6 #define CONTENT_COMMON_CHROME_APPLICATION_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(__OBJC__) 9 #if defined(__OBJC__)
10 10
11 #import <AppKit/AppKit.h> 11 #import <AppKit/AppKit.h>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/scoped_nsobject.h"
15 #import "content/common/mac/scoped_sending_event.h" 14 #import "content/common/mac/scoped_sending_event.h"
16 15
17 // Event hooks must implement this protocol.
18 @protocol CrApplicationEventHookProtocol
19 - (void)hookForEvent:(NSEvent*)theEvent;
20 @end
21
22 @interface CrApplication : NSApplication<CrAppControlProtocol> { 16 @interface CrApplication : NSApplication<CrAppControlProtocol> {
23 @private 17 @private
24 BOOL handlingSendEvent_; 18 BOOL handlingSendEvent_;
25 // Array of objects implementing the CrApplicationEventHookProtocol
26 scoped_nsobject<NSMutableArray> eventHooks_;
27 } 19 }
28 - (BOOL)isHandlingSendEvent; 20 - (BOOL)isHandlingSendEvent;
29 21
30 // Unconditionally clears |handlingSendEvent_|. This should not be 22 // Unconditionally clears |handlingSendEvent_|. This should not be
31 // used except in recovering from some sort of exceptional condition. 23 // used except in recovering from some sort of exceptional condition.
32 - (void)clearIsHandlingSendEvent; 24 - (void)clearIsHandlingSendEvent;
33 25
34 // Add or remove an event hook to be called for every sendEvent:
35 // that the application receives. These handlers are called before
36 // the normal [NSApplication sendEvent:] call is made.
37
38 // This is not a good alternative to a nested event loop. It should
39 // be used only when normal event logic and notification breaks down
40 // (e.g. when clicking outside a canBecomeKey:NO window to "switch
41 // context" out of it).
42 - (void)addEventHook:(id<CrApplicationEventHookProtocol>)hook;
43 - (void)removeEventHook:(id<CrApplicationEventHookProtocol>)hook;
44
45 + (NSApplication*)sharedApplication; 26 + (NSApplication*)sharedApplication;
46 @end 27 @end
47 28
48 #endif // defined(__OBJC__) 29 #endif // defined(__OBJC__)
49 30
50 namespace chrome_application_mac { 31 namespace chrome_application_mac {
51 32
52 // To be used to instantiate CrApplication from C++ code. 33 // To be used to instantiate CrApplication from C++ code.
53 void RegisterCrApp(); 34 void RegisterCrApp();
54 35
55 } // namespace chrome_application_mac 36 } // namespace chrome_application_mac
56 37
57 #endif // CONTENT_COMMON_CHROME_APPLICATION_MAC_H_ 38 #endif // CONTENT_COMMON_CHROME_APPLICATION_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698