| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/fullscreen/fullscreen_toolbar_mouse_tracker.h" | 5 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_mouse_tracker.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 7 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 8 #include "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_contro
ller.h" | 8 #include "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_contro
ller.h" |
| 9 #import "chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h" | 9 #import "chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h" |
| 10 #include "ui/base/cocoa/appkit_utils.h" | 10 #include "ui/base/cocoa/appkit_utils.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 if (!trackingArea_) | 101 if (!trackingArea_) |
| 102 return; | 102 return; |
| 103 | 103 |
| 104 DCHECK(contentView_); | 104 DCHECK(contentView_); |
| 105 [contentView_ removeTrackingArea:trackingArea_]; | 105 [contentView_ removeTrackingArea:trackingArea_]; |
| 106 trackingArea_.reset(); | 106 trackingArea_.reset(); |
| 107 contentView_ = nil; | 107 contentView_ = nil; |
| 108 } | 108 } |
| 109 | 109 |
| 110 - (BOOL)mouseInsideTrackingArea { | 110 - (BOOL)mouseInsideTrackingArea { |
| 111 if (!trackingArea_) | 111 return [trackingArea_ mouseInsideTrackingAreaForView:contentView_]; |
| 112 return NO; | |
| 113 | |
| 114 NSPoint mouseLoc = [[contentView_ window] mouseLocationOutsideOfEventStream]; | |
| 115 NSPoint mousePos = [contentView_ convertPoint:mouseLoc fromView:nil]; | |
| 116 return NSMouseInRect(mousePos, trackingAreaFrame_, [contentView_ isFlipped]); | |
| 117 } | 112 } |
| 118 | 113 |
| 119 - (void)mouseEntered:(NSEvent*)event { | 114 - (void)mouseEntered:(NSEvent*)event { |
| 120 // Empty implementation. Required for CrTrackingArea. | 115 // Empty implementation. Required for CrTrackingArea. |
| 121 } | 116 } |
| 122 | 117 |
| 123 - (void)mouseExited:(NSEvent*)event { | 118 - (void)mouseExited:(NSEvent*)event { |
| 124 DCHECK_EQ([event trackingArea], trackingArea_.get()); | 119 DCHECK_EQ([event trackingArea], trackingArea_.get()); |
| 125 | 120 |
| 126 animationController_->AnimateToolbarOutIfPossible(); | 121 animationController_->AnimateToolbarOutIfPossible(); |
| 127 | 122 |
| 128 [owner_ updateToolbar]; | 123 [owner_ updateToolbar]; |
| 129 [self removeTrackingArea]; | 124 [self removeTrackingArea]; |
| 130 } | 125 } |
| 131 | 126 |
| 132 @end | 127 @end |
| OLD | NEW |