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

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

Issue 2297993002: [Not for review] [Mac] Fullscreen Toolbar Edge Cases
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 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 enum HiddenToolbarState {
27 TOOLBAR_SHOWN = 0, // Toolbar fully visible, toolbarFraction is 1.0.
28 TOOLBAR_HIDDEN, // Toolbar fully hidden, toolbarFraction is 0.0.
29 TOOLBAR_TRANSITIONING, // Toolbar in progress of showing/hiding.
30 // toolbarFraction is (0.0, 1.0).
31 };
32
25 } // namespace fullscreen_mac 33 } // namespace fullscreen_mac
26 34
27 // Provides a controller to fullscreen toolbar for a single browser 35 // Provides a controller to fullscreen toolbar for a single browser
28 // window. This class handles running animations, showing and hiding the 36 // window. This class handles running animations, showing and hiding the
29 // fullscreen toolbar, and managing the tracking area associated with the 37 // fullscreen toolbar, and managing the tracking area associated with the
30 // toolbar. This class does not directly manage any views -- the 38 // toolbar. This class does not directly manage any views -- the
31 // BrowserWindowController is responsible for positioning and z-ordering views. 39 // BrowserWindowController is responsible for positioning and z-ordering views.
32 // 40 //
33 41
34 // TODO (spqchan): Write tests for this class. See crbug.com/640064. 42 // 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. 79 // bar when this controller is destroyed.
72 base::mac::FullScreenMode systemFullscreenMode_; 80 base::mac::FullScreenMode systemFullscreenMode_;
73 81
74 // Whether the omnibox is hidden in fullscreen. 82 // Whether the omnibox is hidden in fullscreen.
75 fullscreen_mac::SlidingStyle slidingStyle_; 83 fullscreen_mac::SlidingStyle slidingStyle_;
76 84
77 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1. 85 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1.
78 // Only used in AppKit Fullscreen. 86 // Only used in AppKit Fullscreen.
79 CGFloat menubarFraction_; 87 CGFloat menubarFraction_;
80 88
81 // The toolbar fraction set by the menu progress. 89 // The state of the toolbar when the sliding style is set to
82 CGFloat toolbarFractionFromMenuProgress_; 90 // OMNIBOX_TABS_HIDDEN.
91 fullscreen_mac::HiddenToolbarState hiddenToolbarState_;
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 menubar is disappearing/gone and the toolbar should still be
91 // This is set and unset in hideTimer:. It's set to YES before it calls 100 // shown. Set to false after the toolbar hides.
92 // animateToolbarVisibility: and then set to NO after the animation has 101 BOOL shouldShowToolbarWithoutMenu_;
93 // started.
94 BOOL shouldAnimateToolbarOut_;
95 } 102 }
96 103
97 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle; 104 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle;
98 105
99 // Designated initializer. 106 // Designated initializer.
100 - (id)initWithBrowserController:(BrowserWindowController*)controller 107 - (id)initWithBrowserController:(BrowserWindowController*)controller
101 style:(fullscreen_mac::SlidingStyle)style; 108 style:(fullscreen_mac::SlidingStyle)style;
102 109
103 // Informs the controller that the browser has entered or exited fullscreen 110 // Informs the controller that the browser has entered or exited fullscreen
104 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called 111 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called
105 // after the window is setup, just before it is shown. |-exitFullscreenMode| 112 // 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 113 // should be called before any views are moved back to the non-fullscreen
107 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called, 114 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called,
108 // it must be balanced with a call to |-exitFullscreenMode| before the 115 // it must be balanced with a call to |-exitFullscreenMode| before the
109 // controller is released. 116 // controller is released.
110 - (void)setupFullscreenToolbarForContentView:(NSView*)contentView; 117 - (void)setupFullscreenToolbarForContentView:(NSView*)contentView;
111 - (void)exitFullscreenMode; 118 - (void)exitFullscreenMode;
112 119
113 // Returns the amount by which the floating bar should be offset downwards (to 120 // 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. 121 // 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 122 // Generally, this is > 0 when the window is on the primary screen and 0
116 // otherwise. 123 // otherwise.
117 - (CGFloat)floatingBarVerticalOffset; 124 - (CGFloat)floatingBarVerticalOffset;
118 125
119 // Informs the controller that the overlay should be shown/hidden, possibly 126 // Informs the controller that the overlay should be shown/hidden, possibly
120 // with animation. 127 // with animation.
121 - (void)ensureOverlayShownWithAnimation:(BOOL)animate; 128 - (void)showToolbarIfPossibleWithAnimation:(BOOL)animate;
122 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate; 129 - (void)hideToolbarIfPossibleWithAnimation:(BOOL)animate;
123 130
124 // Cancels any running animation and timers. 131 // Cancels any running animation and timers.
125 - (void)cancelAnimationAndTimer; 132 - (void)cancelAnimationAndTimer;
126 133
127 // Animates the toolbar dropping down to show changes to the tab strip. 134 // Animates the toolbar dropping down to show changes to the tab strip.
128 - (void)revealToolbarForTabStripChanges; 135 - (void)revealToolbarForTabStripChanges;
129 136
130 // In any fullscreen mode, the y offset to use for the content at the top of 137 // In any fullscreen mode, the y offset to use for the content at the top of
131 // the screen (tab strip, omnibox, bookmark bar, etc). 138 // the screen (tab strip, omnibox, bookmark bar, etc).
132 // Ranges from 0 to -22. 139 // Ranges from 0 to -22.
(...skipping 29 matching lines...) Expand all
162 @interface FullscreenToolbarController (ExposedForTesting) 169 @interface FullscreenToolbarController (ExposedForTesting)
163 // Adjusts the AppKit Fullscreen options of the application. 170 // Adjusts the AppKit Fullscreen options of the application.
164 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; 171 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode;
165 172
166 // Callback for menu bar animations. 173 // Callback for menu bar animations.
167 - (void)setMenuBarRevealProgress:(CGFloat)progress; 174 - (void)setMenuBarRevealProgress:(CGFloat)progress;
168 175
169 @end 176 @end
170 177
171 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ 178 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.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