OLD | NEW |
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 CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ |
7 | 7 |
8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
9 | 9 |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
11 | 11 |
12 @class CrTrackingAreaOwnerProxy; | 12 @class CrTrackingAreaOwnerProxy; |
13 | 13 |
14 // The CrTrackingArea can be used in place of an NSTrackingArea to shut off | 14 // The CrTrackingArea can be used in place of an NSTrackingArea to shut off |
15 // messaging to the |owner| at a specific point in time. | 15 // messaging to the |owner| at a specific point in time. |
16 @interface CrTrackingArea : NSTrackingArea { | 16 @interface CrTrackingArea : NSTrackingArea { |
17 @private | 17 @private |
18 scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy_; | 18 scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy_; |
19 } | 19 } |
20 | 20 |
21 // Designated initializer. Forwards all arguments to the superclass, but wraps | 21 // Designated initializer. Forwards all arguments to the superclass, but wraps |
22 // |owner| in a proxy object. | 22 // |owner| in a proxy object. |
23 // | |
24 // The |proxiedOwner:| paramater has been renamed due to an incompatiblity with | |
25 // the 10.5 SDK. Since that SDK version declares |-[NSTrackingArea's init...]|'s | |
26 // return type to be |NSTrackingArea*| rather than |id|, a more generalized type | |
27 // can't be returned by the subclass. Until the project switches to the 10.6 SDK | |
28 // (where Apple changed the return type to |id|), this ugly hack must exist. | |
29 // TODO(rsesek): Remove this when feasabile. | |
30 - (id)initWithRect:(NSRect)rect | 23 - (id)initWithRect:(NSRect)rect |
31 options:(NSTrackingAreaOptions)options | 24 options:(NSTrackingAreaOptions)options |
32 proxiedOwner:(id)owner // 10.5 SDK hack. Remove at some point. | 25 owner:(id)owner |
33 userInfo:(NSDictionary*)userInfo; | 26 userInfo:(NSDictionary*)userInfo; |
34 | 27 |
35 // Prevents any future messages from being delivered to the |owner|. | 28 // Prevents any future messages from being delivered to the |owner|. |
36 - (void)clearOwner; | 29 - (void)clearOwner; |
37 | 30 |
38 // Watches |window| for its NSWindowWillCloseNotification and calls | 31 // Watches |window| for its NSWindowWillCloseNotification and calls |
39 // |-clearOwner| when the notification is observed. | 32 // |-clearOwner| when the notification is observed. |
40 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; | 33 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; |
41 | 34 |
42 @end | 35 @end |
(...skipping 14 matching lines...) Expand all Loading... |
57 void reset(CrTrackingArea* tracking_area = nil); | 50 void reset(CrTrackingArea* tracking_area = nil); |
58 | 51 |
59 CrTrackingArea* get() const; | 52 CrTrackingArea* get() const; |
60 | 53 |
61 private: | 54 private: |
62 scoped_nsobject<CrTrackingArea> tracking_area_; | 55 scoped_nsobject<CrTrackingArea> tracking_area_; |
63 DISALLOW_COPY_AND_ASSIGN(ScopedCrTrackingArea); | 56 DISALLOW_COPY_AND_ASSIGN(ScopedCrTrackingArea); |
64 }; | 57 }; |
65 | 58 |
66 #endif // CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ | 59 #endif // CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ |
OLD | NEW |