| 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 UI_BASE_COCOA_TRACKING_AREA_H_ | 5 #ifndef UI_BASE_COCOA_TRACKING_AREA_H_ |
| 6 #define UI_BASE_COCOA_TRACKING_AREA_H_ | 6 #define UI_BASE_COCOA_TRACKING_AREA_H_ |
| 7 | 7 |
| 8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 owner:(id)owner | 28 owner:(id)owner |
| 29 userInfo:(NSDictionary*)userInfo; | 29 userInfo:(NSDictionary*)userInfo; |
| 30 | 30 |
| 31 // Prevents any future messages from being delivered to the |owner|. | 31 // Prevents any future messages from being delivered to the |owner|. |
| 32 - (void)clearOwner; | 32 - (void)clearOwner; |
| 33 | 33 |
| 34 // Watches |window| for its NSWindowWillCloseNotification and calls | 34 // Watches |window| for its NSWindowWillCloseNotification and calls |
| 35 // |-clearOwner| when the notification is observed. | 35 // |-clearOwner| when the notification is observed. |
| 36 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; | 36 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; |
| 37 | 37 |
| 38 // Returns YES if the mouse is inside the tracking area's rect. |view| is the |
| 39 // NSView the tracking area is attached to. |
| 40 - (BOOL)mouseInsideTrackingAreaForView:(NSView*)view; |
| 41 |
| 38 @end | 42 @end |
| 39 | 43 |
| 40 // Scoper ////////////////////////////////////////////////////////////////////// | 44 // Scoper ////////////////////////////////////////////////////////////////////// |
| 41 | 45 |
| 42 namespace ui { | 46 namespace ui { |
| 43 | 47 |
| 44 // Use an instance of this class to call |-clearOwner| on the |tracking_area_| | 48 // Use an instance of this class to call |-clearOwner| on the |tracking_area_| |
| 45 // when this goes out of scope. | 49 // when this goes out of scope. |
| 46 class UI_BASE_EXPORT ScopedCrTrackingArea { | 50 class UI_BASE_EXPORT ScopedCrTrackingArea { |
| 47 public: | 51 public: |
| 48 // Takes ownership of |tracking_area| without retaining it. | 52 // Takes ownership of |tracking_area| without retaining it. |
| 49 explicit ScopedCrTrackingArea(CrTrackingArea* tracking_area = nil); | 53 explicit ScopedCrTrackingArea(CrTrackingArea* tracking_area = nil); |
| 50 ~ScopedCrTrackingArea(); | 54 ~ScopedCrTrackingArea(); |
| 51 | 55 |
| 52 // This will call |scoped_nsobject<>::reset()| to take ownership of the new | 56 // This will call |scoped_nsobject<>::reset()| to take ownership of the new |
| 53 // tracking area. Note that -clearOwner is NOT called on the existing | 57 // tracking area. Note that -clearOwner is NOT called on the existing |
| 54 // tracking area. | 58 // tracking area. |
| 55 void reset(CrTrackingArea* tracking_area = nil); | 59 void reset(CrTrackingArea* tracking_area = nil); |
| 56 | 60 |
| 57 CrTrackingArea* get() const; | 61 CrTrackingArea* get() const; |
| 58 | 62 |
| 59 private: | 63 private: |
| 60 base::scoped_nsobject<CrTrackingArea> tracking_area_; | 64 base::scoped_nsobject<CrTrackingArea> tracking_area_; |
| 61 DISALLOW_COPY_AND_ASSIGN(ScopedCrTrackingArea); | 65 DISALLOW_COPY_AND_ASSIGN(ScopedCrTrackingArea); |
| 62 }; | 66 }; |
| 63 | 67 |
| 64 } // namespace ui | 68 } // namespace ui |
| 65 | 69 |
| 66 #endif // UI_BASE_COCOA_TRACKING_AREA_H_ | 70 #endif // UI_BASE_COCOA_TRACKING_AREA_H_ |
| OLD | NEW |