| 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/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Prevents any future messages from being delivered to the |owner|. | 35 // Prevents any future messages from being delivered to the |owner|. |
| 36 - (void)clearOwner; | 36 - (void)clearOwner; |
| 37 | 37 |
| 38 // Watches |window| for its NSWindowWillCloseNotification and calls | 38 // Watches |window| for its NSWindowWillCloseNotification and calls |
| 39 // |-clearOwner| when the notification is observed. | 39 // |-clearOwner| when the notification is observed. |
| 40 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; | 40 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window; |
| 41 | 41 |
| 42 @end | 42 @end |
| 43 | 43 |
| 44 // Scoper ////////////////////////////////////////////////////////////////////// |
| 45 |
| 46 // Use an instance of this class to call |-clearOwner| on the |tracking_area_| |
| 47 // when this goes out of scope. |
| 48 class ScopedCrTrackingArea { |
| 49 public: |
| 50 // Takes ownership of |tracking_area| without retaining it. |
| 51 explicit ScopedCrTrackingArea(CrTrackingArea* tracking_area = nil); |
| 52 ~ScopedCrTrackingArea(); |
| 53 |
| 54 // This will call |scoped_nsobject<>::reset()| to take ownership of the new |
| 55 // tracking area. |
| 56 void reset(CrTrackingArea* tracking_area = nil); |
| 57 |
| 58 CrTrackingArea* get() const; |
| 59 |
| 60 private: |
| 61 scoped_nsobject<CrTrackingArea> tracking_area_; |
| 62 DISALLOW_COPY_AND_ASSIGN(ScopedCrTrackingArea); |
| 63 }; |
| 64 |
| 44 #endif // CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ | 65 #endif // CHROME_BROWSER_UI_COCOA_TRACKING_AREA_H_ |
| OLD | NEW |