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/fullscreen_toolbar_controller.h" | 9 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" |
10 #include "ui/base/cocoa/appkit_utils.h" | 10 #include "ui/base/cocoa/appkit_utils.h" |
11 #import "ui/base/cocoa/tracking_area.h" | 11 #import "ui/base/cocoa/tracking_area.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // Additional height threshold added at the toolbar's bottom. This is to mimic | 15 // Additional height threshold added at the toolbar's bottom. This is to mimic |
16 // threshold the mouse position needs to be at before the menubar automatically | 16 // threshold the mouse position needs to be at before the menubar automatically |
17 // hides. | 17 // hides. |
18 const CGFloat kTrackingAreaAdditionalThreshold = 20; | 18 const CGFloat kTrackingAreaAdditionalThreshold = 50; |
19 | 19 |
20 } // namespace | 20 } // namespace |
21 | 21 |
22 @interface FullscreenToolbarMouseTracker () { | 22 @interface FullscreenToolbarMouseTracker () { |
23 // The frame for the tracking area. The value is the toolbar's frame with | 23 // The frame for the tracking area. The value is the toolbar's frame with |
24 // additional height added at the bottom. | 24 // additional height added at the bottom. |
25 NSRect trackingAreaFrame_; | 25 NSRect trackingAreaFrame_; |
26 | 26 |
27 // The tracking area associated with the toolbar. This tracking area is used | 27 // The tracking area associated with the toolbar. This tracking area is used |
28 // to keep the toolbar active if the menubar had animated out but the mouse | 28 // to keep the toolbar active if the menubar had animated out but the mouse |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 - (void)mouseExited:(NSEvent*)event { | 118 - (void)mouseExited:(NSEvent*)event { |
119 DCHECK_EQ([event trackingArea], trackingArea_.get()); | 119 DCHECK_EQ([event trackingArea], trackingArea_.get()); |
120 | 120 |
121 animationController_->AnimateToolbarOutIfPossible(); | 121 animationController_->AnimateToolbarOutIfPossible(); |
122 | 122 |
123 [owner_ updateToolbarLayout]; | 123 [owner_ updateToolbarLayout]; |
124 [self removeTrackingArea]; | 124 [self removeTrackingArea]; |
125 } | 125 } |
126 | 126 |
127 @end | 127 @end |
OLD | NEW |