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

Side by Side Diff: chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h

Issue 2339663002: [Mac] Fullscreen Toolbar Bar Visibility Edge Cases (Closed)
Patch Set: Created 4 years, 3 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FULLSCREEN_TOOLBAR_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_
7 7
8 #include <Carbon/Carbon.h> 8 #include <Carbon/Carbon.h>
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 10
11 #include "base/mac/mac_util.h" 11 #include "base/mac/mac_util.h"
12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
13 13
14 @class BrowserWindowController; 14 @class BrowserWindowController;
15 @class CrTrackingArea; 15 @class CrTrackingArea;
16 @class DropdownAnimation; 16 @class DropdownAnimation;
17 17
18 namespace fullscreen_mac { 18 enum class FullscreenSlidingStyle {
19 enum SlidingStyle { 19 OMNIBOX_TABS_PRESENT, // Tab strip and omnibox both visible.
20 OMNIBOX_TABS_PRESENT = 0, // Tab strip and omnibox both visible. 20 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden.
21 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden. 21 OMNIBOX_TABS_NONE, // Tab strip and omnibox both hidden and never
22 OMNIBOX_TABS_NONE, // Tab strip and omnibox both hidden and never 22 // shown.
23 // shown.
24 }; 23 };
25 } // namespace fullscreen_mac 24
25 // State of the menubar in the window's screen.
26 enum class FullscreenMenubarState {
27 SHOWN, // Menubar is fully shown.
28 HIDDEN, // Menubar is fully hidden.
29 SHOWING, // Menubar is animating in.
30 HIDING, // Menubar is animating out.
31 };
26 32
27 // Provides a controller to fullscreen toolbar for a single browser 33 // Provides a controller to fullscreen toolbar for a single browser
28 // window. This class handles running animations, showing and hiding the 34 // window. This class handles running animations, showing and hiding the
29 // fullscreen toolbar, and managing the tracking area associated with the 35 // fullscreen toolbar, and managing the tracking area associated with the
30 // toolbar. This class does not directly manage any views -- the 36 // toolbar. This class does not directly manage any views -- the
31 // BrowserWindowController is responsible for positioning and z-ordering views. 37 // BrowserWindowController is responsible for positioning and z-ordering views.
32 // 38 //
33 39
34 // TODO (spqchan): Write tests for this class. See crbug.com/640064. 40 // TODO (spqchan): Write tests for this class. See crbug.com/640064.
35 @interface FullscreenToolbarController : NSObject<NSAnimationDelegate> { 41 @interface FullscreenToolbarController : NSObject<NSAnimationDelegate> {
(...skipping 29 matching lines...) Expand all
65 // is not main or not fullscreen, |kFullScreenModeHideAll| while the overlay 71 // is not main or not fullscreen, |kFullScreenModeHideAll| while the overlay
66 // is hidden, and |kFullScreenModeHideDock| while the overlay is shown. If 72 // is hidden, and |kFullScreenModeHideDock| while the overlay is shown. If
67 // the window is not on the primary screen, this should always be 73 // the window is not on the primary screen, this should always be
68 // |kFullScreenModeNormal|. This value can get out of sync with the correct 74 // |kFullScreenModeNormal|. This value can get out of sync with the correct
69 // state if we miss a notification (which can happen when a window is closed). 75 // state if we miss a notification (which can happen when a window is closed).
70 // Used to track the current state and make sure we properly restore the menu 76 // Used to track the current state and make sure we properly restore the menu
71 // bar when this controller is destroyed. 77 // bar when this controller is destroyed.
72 base::mac::FullScreenMode systemFullscreenMode_; 78 base::mac::FullScreenMode systemFullscreenMode_;
73 79
74 // Whether the omnibox is hidden in fullscreen. 80 // Whether the omnibox is hidden in fullscreen.
75 fullscreen_mac::SlidingStyle slidingStyle_; 81 FullscreenSlidingStyle slidingStyle_;
76 82
77 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1. 83 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1.
78 // Only used in AppKit Fullscreen. 84 // Only used in AppKit Fullscreen.
79 CGFloat menubarFraction_; 85 CGFloat menubarFraction_;
80 86
81 // The toolbar fraction set by the menu progress. 87 // The state of the menubar in fullscreen.
82 CGFloat toolbarFractionFromMenuProgress_; 88 FullscreenMenubarState menubarState_;
83 89
84 // A Carbon event handler that tracks the revealed fraction of the menu bar. 90 // A Carbon event handler that tracks the revealed fraction of the menu bar.
85 EventHandlerRef menuBarTrackingHandler_; 91 EventHandlerRef menuBarTrackingHandler_;
86 92
87 // True when the toolbar is dropped to show tabstrip changes. 93 // True when the toolbar is dropped to show tabstrip changes.
88 BOOL isRevealingToolbarForTabStripChanges_; 94 BOOL isRevealingToolbarForTabStripChanges_;
89 95
90 // True when the toolbar should be animated back out via a DropdownAnimation. 96 // True when the toolbar should be animated back out via a DropdownAnimation.
91 // This is set and unset in hideTimer:. It's set to YES before it calls 97 // This is set and unset in hideTimer: and mouseExited:. It's set to YES
92 // animateToolbarVisibility: and then set to NO after the animation has 98 // before it calls animateToolbarVisibility: and then set to NO after the
93 // started. 99 // animation has started.
94 BOOL shouldAnimateToolbarOut_; 100 BOOL shouldAnimateToolbarOut_;
101
102 // True when the toolbar is animating in/out for changes in the toolbar
103 // visibility locks.
104 BOOL isLockingBarVisibility_;
105 BOOL isReleasingBarVisibility_;
95 } 106 }
96 107
97 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle; 108 @property(nonatomic, assign) FullscreenSlidingStyle slidingStyle;
98 109
99 // Designated initializer. 110 // Designated initializer.
100 - (id)initWithBrowserController:(BrowserWindowController*)controller 111 - (id)initWithBrowserController:(BrowserWindowController*)controller
101 style:(fullscreen_mac::SlidingStyle)style; 112 style:(FullscreenSlidingStyle)style;
102 113
103 // Informs the controller that the browser has entered or exited fullscreen 114 // Informs the controller that the browser has entered or exited fullscreen
104 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called 115 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called
105 // after the window is setup, just before it is shown. |-exitFullscreenMode| 116 // after the window is setup, just before it is shown. |-exitFullscreenMode|
106 // should be called before any views are moved back to the non-fullscreen 117 // should be called before any views are moved back to the non-fullscreen
107 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called, 118 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called,
108 // it must be balanced with a call to |-exitFullscreenMode| before the 119 // it must be balanced with a call to |-exitFullscreenMode| before the
109 // controller is released. 120 // controller is released.
110 - (void)setupFullscreenToolbarForContentView:(NSView*)contentView; 121 - (void)setupFullscreenToolbarForContentView:(NSView*)contentView;
111 - (void)exitFullscreenMode; 122 - (void)exitFullscreenMode;
112 123
113 // Returns the amount by which the floating bar should be offset downwards (to 124 // Returns the amount by which the floating bar should be offset downwards (to
114 // avoid the menu) and by which the overlay view should be enlarged vertically. 125 // avoid the menu) and by which the overlay view should be enlarged vertically.
115 // Generally, this is > 0 when the window is on the primary screen and 0 126 // Generally, this is > 0 when the window is on the primary screen and 0
116 // otherwise. 127 // otherwise.
117 - (CGFloat)floatingBarVerticalOffset; 128 - (CGFloat)floatingBarVerticalOffset;
118 129
130 // Shows/hides the toolbar with animation to reflect changes for the toolbar
131 // visibility locks. lockBarVisibilityWithAnimation: should only be called when
132 // the lock state goes from unlocked to locked. Likewise,
133 // releaseBarVisibilityWithAnimation: should only be called whenthe lock state
134 // goes from locked to unlocked.
135 - (void)lockBarVisibilityWithAnimation:(BOOL)animate;
136 - (void)releaseBarVisibilityWithAnimation:(BOOL)animate;
137
119 // Informs the controller that the overlay should be shown/hidden, possibly 138 // Informs the controller that the overlay should be shown/hidden, possibly
120 // with animation. 139 // with animation.
121 - (void)ensureOverlayShownWithAnimation:(BOOL)animate; 140 - (void)ensureOverlayShownWithAnimation:(BOOL)animate;
122 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate; 141 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate;
123 142
124 // Cancels any running animation and timers. 143 // Cancels any running animation and timers.
125 - (void)cancelAnimationAndTimer; 144 - (void)cancelAnimationAndTimer;
126 145
127 // Animates the toolbar dropping down to show changes to the tab strip. 146 // Animates the toolbar dropping down to show changes to the tab strip.
128 - (void)revealToolbarForTabStripChanges; 147 - (void)revealToolbarForTabStripChanges;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 @interface FullscreenToolbarController (ExposedForTesting) 181 @interface FullscreenToolbarController (ExposedForTesting)
163 // Adjusts the AppKit Fullscreen options of the application. 182 // Adjusts the AppKit Fullscreen options of the application.
164 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; 183 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode;
165 184
166 // Callback for menu bar animations. 185 // Callback for menu bar animations.
167 - (void)setMenuBarRevealProgress:(CGFloat)progress; 186 - (void)setMenuBarRevealProgress:(CGFloat)progress;
168 187
169 @end 188 @end
170 189
171 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ 190 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_layout_unittest.mm ('k') | chrome/browser/ui/cocoa/fullscreen_toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698