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

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

Issue 2459653005: [Mac] Refactor the Fullscreen Toolbar Visibility Locks (Closed)
Patch Set: Fix for rsesek Created 4 years, 1 month 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 FullscreenMenubarTracker; 15 @class FullscreenMenubarTracker;
16 class FullscreenToolbarAnimationController; 16 class FullscreenToolbarAnimationController;
17 @class FullscreenToolbarMouseTracker; 17 @class FullscreenToolbarMouseTracker;
18 @class FullscreenToolbarVisibilityLockController;
18 19
19 enum class FullscreenSlidingStyle { 20 enum class FullscreenSlidingStyle {
20 OMNIBOX_TABS_PRESENT, // Tab strip and omnibox both visible. 21 OMNIBOX_TABS_PRESENT, // Tab strip and omnibox both visible.
21 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden. 22 OMNIBOX_TABS_HIDDEN, // Tab strip and omnibox both hidden.
22 OMNIBOX_TABS_NONE, // Tab strip and omnibox both hidden and never 23 OMNIBOX_TABS_NONE, // Tab strip and omnibox both hidden and never
23 // shown. 24 // shown.
24 }; 25 };
25 26
26 // Provides a controller to fullscreen toolbar for a single browser 27 // Provides a controller to fullscreen toolbar for a single browser
27 // window. This class handles running animations, showing and hiding the 28 // window. This class handles running animations, showing and hiding the
28 // fullscreen toolbar, and managing the tracking area associated with the 29 // fullscreen toolbar, and managing the tracking area associated with the
29 // toolbar. This class does not directly manage any views -- the 30 // toolbar. This class does not directly manage any views -- the
30 // BrowserWindowController is responsible for positioning and z-ordering views. 31 // BrowserWindowController is responsible for positioning and z-ordering views.
31 // 32 //
32 33
33 // TODO (spqchan): Write tests for this class. See crbug.com/640064. 34 // TODO (spqchan): Write tests for this class. See crbug.com/640064.
34 @interface FullscreenToolbarController : NSObject { 35 @interface FullscreenToolbarController : NSObject {
35 @private 36 @private
36 // Our parent controller. 37 // Our parent controller.
37 BrowserWindowController* browserController_; // weak 38 BrowserWindowController* browserController_; // weak
38 39
39 // Whether or not we are in fullscreen mode. 40 // Whether or not we are in fullscreen mode.
40 BOOL inFullscreenMode_; 41 BOOL inFullscreenMode_;
41 42
42 // Updates the fullscreen toolbar layout for changes in the menubar. This 43 // Updates the fullscreen toolbar layout for changes in the menubar. This
43 // object is only set when the browser is in fullscreen mode. 44 // object is only set when the browser is in fullscreen mode.
44 base::scoped_nsobject<FullscreenMenubarTracker> menubarTracker_; 45 base::scoped_nsobject<FullscreenMenubarTracker> menubarTracker_;
45 46
47 // Maintains the toolbar's visibility locks for the
48 // OMNIBOX_TABS_HIDDEN style.
49 base::scoped_nsobject<FullscreenToolbarVisibilityLockController>
50 visibilityLockController_;
51
46 // Manages the toolbar animations for the OMNIBOX_TABS_HIDDEN style. 52 // Manages the toolbar animations for the OMNIBOX_TABS_HIDDEN style.
47 std::unique_ptr<FullscreenToolbarAnimationController> animationController_; 53 std::unique_ptr<FullscreenToolbarAnimationController> animationController_;
48 54
49 // Mouse tracker to track the user's interactions with the toolbar. This 55 // Mouse tracker to track the user's interactions with the toolbar. This
50 // object is only set when the browser is in fullscreen mode. 56 // object is only set when the browser is in fullscreen mode.
51 base::scoped_nsobject<FullscreenToolbarMouseTracker> mouseTracker_; 57 base::scoped_nsobject<FullscreenToolbarMouseTracker> mouseTracker_;
52 58
53 // Tracks the currently requested system fullscreen mode, used to show or 59 // Tracks the currently requested system fullscreen mode, used to show or
54 // hide the menubar. This should be |kFullScreenModeNormal| when the window 60 // hide the menubar. This should be |kFullScreenModeNormal| when the window
55 // is not main or not fullscreen, |kFullScreenModeHideAll| while the overlay 61 // is not main or not fullscreen, |kFullScreenModeHideAll| while the overlay
(...skipping 18 matching lines...) Expand all
74 // Informs the controller that the browser has entered or exited fullscreen 80 // Informs the controller that the browser has entered or exited fullscreen
75 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called 81 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called
76 // after the window is setup, just before it is shown. |-exitFullscreenMode| 82 // after the window is setup, just before it is shown. |-exitFullscreenMode|
77 // should be called before any views are moved back to the non-fullscreen 83 // should be called before any views are moved back to the non-fullscreen
78 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called, 84 // window. If |-setupFullscreenToolbarForContentView:showDropdown:| is called,
79 // it must be balanced with a call to |-exitFullscreenMode| before the 85 // it must be balanced with a call to |-exitFullscreenMode| before the
80 // controller is released. 86 // controller is released.
81 - (void)enterFullscreenMode; 87 - (void)enterFullscreenMode;
82 - (void)exitFullscreenMode; 88 - (void)exitFullscreenMode;
83 89
84 // Informs the controller that the overlay should be shown/hidden, possibly
85 // with animation.
86 - (void)ensureOverlayShownWithAnimation:(BOOL)animate;
87 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate;
88
89 // Cancels any running animation and timers. 90 // Cancels any running animation and timers.
90 - (void)cancelAnimationAndTimer; 91 - (void)cancelAnimationAndTimer;
91 92
92 // Animates the toolbar dropping down to show changes to the tab strip. 93 // Animates the toolbar dropping down to show changes to the tab strip.
93 - (void)revealToolbarForTabStripChanges; 94 - (void)revealToolbarForTabStripChanges;
94 95
95 // In any fullscreen mode, the y offset to use for the content at the top of 96 // In any fullscreen mode, the y offset to use for the content at the top of
96 // the screen (tab strip, omnibox, bookmark bar, etc). 97 // the screen (tab strip, omnibox, bookmark bar, etc).
97 // Ranges from 0 to -22. 98 // Ranges from 0 to -22.
98 - (CGFloat)menubarOffset; 99 - (CGFloat)menubarOffset;
(...skipping 21 matching lines...) Expand all
120 121
121 // Returns YES if the browser in in fullscreen. 122 // Returns YES if the browser in in fullscreen.
122 - (BOOL)isInFullscreen; 123 - (BOOL)isInFullscreen;
123 124
124 // Updates the toolbar by updating the layout, menubar and dock. 125 // Updates the toolbar by updating the layout, menubar and dock.
125 - (void)updateToolbar; 126 - (void)updateToolbar;
126 127
127 // Returns |browserController_|. 128 // Returns |browserController_|.
128 - (BrowserWindowController*)browserWindowController; 129 - (BrowserWindowController*)browserWindowController;
129 130
131 // Returns the object in |visibilityLockController_|;
132 - (FullscreenToolbarVisibilityLockController*)visibilityLockController;
133
130 @end 134 @end
131 135
132 // Private methods exposed for testing. 136 // Private methods exposed for testing.
133 @interface FullscreenToolbarController (ExposedForTesting) 137 @interface FullscreenToolbarController (ExposedForTesting)
134 // Adjusts the AppKit Fullscreen options of the application. 138 // Adjusts the AppKit Fullscreen options of the application.
135 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; 139 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode;
136 140
137 // Callback for menu bar animations. 141 // Callback for menu bar animations.
138 - (void)setMenuBarRevealProgress:(CGFloat)progress; 142 - (void)setMenuBarRevealProgress:(CGFloat)progress;
139 143
140 @end 144 @end
141 145
142 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ 146 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698