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

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

Issue 2296903002: [Mac] Fullscreen Toolbar Edge Cases (Closed)
Patch Set: edge case 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 namespace fullscreen_mac {
19 enum SlidingStyle { 19 enum SlidingStyle {
20 OMNIBOX_TABS_PRESENT = 0, // Tab strip and omnibox both visible. 20 OMNIBOX_TABS_PRESENT = 0, // Tab strip and omnibox both visible.
21 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden. 21 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden.
22 OMNIBOX_TABS_NONE, // Tab strip and omnibox both hidden and never 22 OMNIBOX_TABS_NONE, // Tab strip and omnibox both hidden and never
23 // shown. 23 // shown.
24 }; 24 };
25
26 // State of the menubar in the window's screen.
27 enum MenubarState {
Robert Sesek 2016/09/08 18:37:42 Follow-up cleanup idea: drop the namespace and mak
spqchan 2016/09/08 21:35:57 Done.
Robert Sesek 2016/09/08 22:40:02 I suggested making this an enum class, not just an
28 MENUBAR_SHOWN = 0, // Menubar is fully shown.
29 MENUBAR_HIDDEN, // Menubar is fully hidden.
30 MENUBAR_SHOWING, // Menubar is animating in.
31 MENUBAR_HIDING, // Menubar is animating out.
32 };
33
25 } // namespace fullscreen_mac 34 } // namespace fullscreen_mac
26 35
27 // Provides a controller to fullscreen toolbar for a single browser 36 // Provides a controller to fullscreen toolbar for a single browser
28 // window. This class handles running animations, showing and hiding the 37 // window. This class handles running animations, showing and hiding the
29 // fullscreen toolbar, and managing the tracking area associated with the 38 // fullscreen toolbar, and managing the tracking area associated with the
30 // toolbar. This class does not directly manage any views -- the 39 // toolbar. This class does not directly manage any views -- the
31 // BrowserWindowController is responsible for positioning and z-ordering views. 40 // BrowserWindowController is responsible for positioning and z-ordering views.
32 // 41 //
33 42
34 // TODO (spqchan): Write tests for this class. See crbug.com/640064. 43 // TODO (spqchan): Write tests for this class. See crbug.com/640064.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // bar when this controller is destroyed. 80 // bar when this controller is destroyed.
72 base::mac::FullScreenMode systemFullscreenMode_; 81 base::mac::FullScreenMode systemFullscreenMode_;
73 82
74 // Whether the omnibox is hidden in fullscreen. 83 // Whether the omnibox is hidden in fullscreen.
75 fullscreen_mac::SlidingStyle slidingStyle_; 84 fullscreen_mac::SlidingStyle slidingStyle_;
76 85
77 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1. 86 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1.
78 // Only used in AppKit Fullscreen. 87 // Only used in AppKit Fullscreen.
79 CGFloat menubarFraction_; 88 CGFloat menubarFraction_;
80 89
81 // The toolbar fraction set by the menu progress. 90 // The state of the menubar in fullscreen.
82 CGFloat toolbarFractionFromMenuProgress_; 91 fullscreen_mac::MenubarState menubarState_;
83 92
84 // A Carbon event handler that tracks the revealed fraction of the menu bar. 93 // A Carbon event handler that tracks the revealed fraction of the menu bar.
85 EventHandlerRef menuBarTrackingHandler_; 94 EventHandlerRef menuBarTrackingHandler_;
86 95
87 // True when the toolbar is dropped to show tabstrip changes. 96 // True when the toolbar is dropped to show tabstrip changes.
88 BOOL isRevealingToolbarForTabStripChanges_; 97 BOOL isRevealingToolbarForTabStripChanges_;
89 98
90 // True when the toolbar should be animated back out via a DropdownAnimation. 99 // 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 100 // 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 101 // before it calls animateToolbarVisibility: and then set to NO after the
93 // started. 102 // animation has started.
94 BOOL shouldAnimateToolbarOut_; 103 BOOL shouldAnimateToolbarOut_;
104
105 // True when the toolbar is animating in/out for changes in the toolbar
106 // visibility locks.
107 BOOL isLockingBarVisibility_;
108 BOOL isReleasingBarVisibility_;
95 } 109 }
96 110
97 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle; 111 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle;
98 112
99 // Designated initializer. 113 // Designated initializer.
100 - (id)initWithBrowserController:(BrowserWindowController*)controller 114 - (id)initWithBrowserController:(BrowserWindowController*)controller
101 style:(fullscreen_mac::SlidingStyle)style; 115 style:(fullscreen_mac::SlidingStyle)style;
102 116
103 // Informs the controller that the browser has entered or exited fullscreen 117 // Informs the controller that the browser has entered or exited fullscreen
104 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called 118 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called
105 // after the window is setup, just before it is shown. |-exitFullscreenMode| 119 // 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 120 // should be called before any views are moved back to the non-fullscreen
107 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called, 121 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called,
108 // it must be balanced with a call to |-exitFullscreenMode| before the 122 // it must be balanced with a call to |-exitFullscreenMode| before the
109 // controller is released. 123 // controller is released.
110 - (void)setupFullscreenToolbarForContentView:(NSView*)contentView; 124 - (void)setupFullscreenToolbarForContentView:(NSView*)contentView;
111 - (void)exitFullscreenMode; 125 - (void)exitFullscreenMode;
112 126
113 // Returns the amount by which the floating bar should be offset downwards (to 127 // 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. 128 // 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 129 // Generally, this is > 0 when the window is on the primary screen and 0
116 // otherwise. 130 // otherwise.
117 - (CGFloat)floatingBarVerticalOffset; 131 - (CGFloat)floatingBarVerticalOffset;
118 132
133 // Shows/hides the toolbar with animation to reflect changes for the toolbar
134 // visibility locks. lockBarVisibilityWithAnimation: should only be called when
135 // the lock state goes from unlocked to locked. Likewise,
136 // releaseBarVisibilityWithAnimation: should only be called whenthe lock state
137 // goes from locked to unlocked.
138 - (void)lockBarVisibilityWithAnimation:(BOOL)animate;
139 - (void)releaseBarVisibilityWithAnimation:(BOOL)animate;
140
119 // Informs the controller that the overlay should be shown/hidden, possibly 141 // Informs the controller that the overlay should be shown/hidden, possibly
120 // with animation. 142 // with animation.
121 - (void)ensureOverlayShownWithAnimation:(BOOL)animate; 143 - (void)ensureOverlayShownWithAnimation:(BOOL)animate;
122 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate; 144 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate;
123 145
124 // Cancels any running animation and timers. 146 // Cancels any running animation and timers.
125 - (void)cancelAnimationAndTimer; 147 - (void)cancelAnimationAndTimer;
126 148
127 // Animates the toolbar dropping down to show changes to the tab strip. 149 // Animates the toolbar dropping down to show changes to the tab strip.
128 - (void)revealToolbarForTabStripChanges; 150 - (void)revealToolbarForTabStripChanges;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 @interface FullscreenToolbarController (ExposedForTesting) 184 @interface FullscreenToolbarController (ExposedForTesting)
163 // Adjusts the AppKit Fullscreen options of the application. 185 // Adjusts the AppKit Fullscreen options of the application.
164 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; 186 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode;
165 187
166 // Callback for menu bar animations. 188 // Callback for menu bar animations.
167 - (void)setMenuBarRevealProgress:(CGFloat)progress; 189 - (void)setMenuBarRevealProgress:(CGFloat)progress;
168 190
169 @end 191 @end
170 192
171 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ 193 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698