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 #import "chrome/browser/ui/cocoa/tracking_area.h" | 5 #import "ui/base/cocoa/tracking_area.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 // NSTrackingArea does not retain its |owner| so CrTrackingArea wraps the real | 9 // NSTrackingArea does not retain its |owner| so CrTrackingArea wraps the real |
10 // owner in this proxy, which can stop forwarding messages to the owner when | 10 // owner in this proxy, which can stop forwarding messages to the owner when |
11 // it is no longer |alive_|. | 11 // it is no longer |alive_|. |
12 @interface CrTrackingAreaOwnerProxy : NSObject { | 12 @interface CrTrackingAreaOwnerProxy : NSObject { |
13 @private | 13 @private |
14 // Whether or not the owner is "alive" and should forward calls to the real | 14 // Whether or not the owner is "alive" and should forward calls to the real |
15 // owner object. | 15 // owner object. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 - (void)windowWillClose:(NSNotification*)notif { | 104 - (void)windowWillClose:(NSNotification*)notif { |
105 [self clearOwner]; | 105 [self clearOwner]; |
106 } | 106 } |
107 | 107 |
108 @end | 108 @end |
109 | 109 |
110 // Scoper ////////////////////////////////////////////////////////////////////// | 110 // Scoper ////////////////////////////////////////////////////////////////////// |
111 | 111 |
| 112 namespace ui { |
| 113 |
112 ScopedCrTrackingArea::ScopedCrTrackingArea(CrTrackingArea* tracking_area) | 114 ScopedCrTrackingArea::ScopedCrTrackingArea(CrTrackingArea* tracking_area) |
113 : tracking_area_(tracking_area) { | 115 : tracking_area_(tracking_area) { |
114 } | 116 } |
115 | 117 |
116 ScopedCrTrackingArea::~ScopedCrTrackingArea() { | 118 ScopedCrTrackingArea::~ScopedCrTrackingArea() { |
117 [tracking_area_ clearOwner]; | 119 [tracking_area_ clearOwner]; |
118 } | 120 } |
119 | 121 |
120 void ScopedCrTrackingArea::reset(CrTrackingArea* tracking_area) { | 122 void ScopedCrTrackingArea::reset(CrTrackingArea* tracking_area) { |
121 tracking_area_.reset(tracking_area); | 123 tracking_area_.reset(tracking_area); |
122 } | 124 } |
123 | 125 |
124 CrTrackingArea* ScopedCrTrackingArea::get() const { | 126 CrTrackingArea* ScopedCrTrackingArea::get() const { |
125 return tracking_area_.get(); | 127 return tracking_area_.get(); |
126 } | 128 } |
| 129 |
| 130 } // namespace ui |
OLD | NEW |