Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: ui/base/cocoa/tracking_area.mm

Issue 2484973004: [Mac] Refactor Immersive Fullscreen Logic (Closed)
Patch Set: fix for rsesek Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/cocoa/tracking_area.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/base/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
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window { 95 - (void)clearOwnerWhenWindowWillClose:(NSWindow*)window {
96 DCHECK(window); 96 DCHECK(window);
97 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 97 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
98 [center addObserver:self 98 [center addObserver:self
99 selector:@selector(windowWillClose:) 99 selector:@selector(windowWillClose:)
100 name:NSWindowWillCloseNotification 100 name:NSWindowWillCloseNotification
101 object:window]; 101 object:window];
102 } 102 }
103 103
104 - (BOOL)mouseInsideTrackingAreaForView:(NSView*)view {
105 DCHECK(view);
106 NSPoint mouseLoc = [[view window] mouseLocationOutsideOfEventStream];
107 NSPoint mousePos = [view convertPoint:mouseLoc fromView:nil];
108 return NSMouseInRect(mousePos, [self rect], [view isFlipped]);
109 }
110
104 - (void)windowWillClose:(NSNotification*)notif { 111 - (void)windowWillClose:(NSNotification*)notif {
105 [self clearOwner]; 112 [self clearOwner];
106 } 113 }
107 114
108 @end 115 @end
109 116
110 // Scoper ////////////////////////////////////////////////////////////////////// 117 // Scoper //////////////////////////////////////////////////////////////////////
111 118
112 namespace ui { 119 namespace ui {
113 120
114 ScopedCrTrackingArea::ScopedCrTrackingArea(CrTrackingArea* tracking_area) 121 ScopedCrTrackingArea::ScopedCrTrackingArea(CrTrackingArea* tracking_area)
115 : tracking_area_(tracking_area) { 122 : tracking_area_(tracking_area) {
116 } 123 }
117 124
118 ScopedCrTrackingArea::~ScopedCrTrackingArea() { 125 ScopedCrTrackingArea::~ScopedCrTrackingArea() {
119 [tracking_area_ clearOwner]; 126 [tracking_area_ clearOwner];
120 } 127 }
121 128
122 void ScopedCrTrackingArea::reset(CrTrackingArea* tracking_area) { 129 void ScopedCrTrackingArea::reset(CrTrackingArea* tracking_area) {
123 tracking_area_.reset(tracking_area); 130 tracking_area_.reset(tracking_area);
124 } 131 }
125 132
126 CrTrackingArea* ScopedCrTrackingArea::get() const { 133 CrTrackingArea* ScopedCrTrackingArea::get() const {
127 return tracking_area_.get(); 134 return tracking_area_.get();
128 } 135 }
129 136
130 } // namespace ui 137 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/cocoa/tracking_area.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698