Chromium Code Reviews| Index: chrome/browser/ui/cocoa/chrome_tracking_area.h |
| diff --git a/chrome/browser/ui/cocoa/chrome_tracking_area.h b/chrome/browser/ui/cocoa/chrome_tracking_area.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..61bd0c39d6d0288f3cca8d096c45129b05919ad4 |
| --- /dev/null |
| +++ b/chrome/browser/ui/cocoa/chrome_tracking_area.h |
| @@ -0,0 +1,37 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_COCOA_CHROME_TRACKING_AREA_H_ |
| +#define CHROME_BROWSER_UI_COCOA_CHROME_TRACKING_AREA_H_ |
| + |
| +#import <AppKit/AppKit.h> |
| + |
| +#include "base/scoped_nsobject.h" |
| + |
| +@class CrTrackingAreaOwnerProxy; |
| + |
| +// The CrTrackingArea can be used in place of an NSTrackingArea to shut off |
| +// messaging to the |owner| at a specific point in time. |
| +@interface CrTrackingArea : NSTrackingArea { |
| + @private |
| + scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy_; |
|
Scott Hess - ex-Googler
2011/02/11 01:17:12
Rather than using |ownerProxy_|, you can override
Robert Sesek
2011/02/11 02:30:50
I went with this approach because it affords us be
Robert Sesek
2011/02/11 19:53:58
Switched to this approach. Closer examination show
Scott Hess - ex-Googler
2011/02/11 20:08:19
AFAICT from tracing messages, -mouseMoved: calls -
|
| +} |
| + |
| +// Designated initializer. Forwards all arguments to the superclass, but wraps |
| +// |owner| in a proxy object. |
| +- (id)initWithRect:(NSRect)rect |
| + options:(NSTrackingAreaOptions)options |
| + owner:(id)owner |
| + userInfo:(NSDictionary*)userInfo; |
| + |
| +// Prevents any future messages from being delivered to the |owner|. |
| +- (void)clearOwner; |
| + |
| +// Watches |window| for its NSWindowWillCloseNotification and calls |
| +// |-clearOwner| when the notification is observed. |
| +- (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; |
| + |
| +@end |
| + |
| +#endif // CHROME_BROWSER_UI_COCOA_CHROME_TRACKING_AREA_H_ |