| OLD | NEW |
| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // shown. | 23 // shown. |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 enum HiddenToolbarState { | 26 enum HiddenToolbarState { |
| 27 TOOLBAR_SHOWN = 0, // Toolbar fully visible, toolbarFraction is 1.0. | 27 TOOLBAR_SHOWN = 0, // Toolbar fully visible, toolbarFraction is 1.0. |
| 28 TOOLBAR_HIDDEN, // Toolbar fully hidden, toolbarFraction is 0.0. | 28 TOOLBAR_HIDDEN, // Toolbar fully hidden, toolbarFraction is 0.0. |
| 29 TOOLBAR_TRANSITIONING, // Toolbar in progress of showing/hiding. | 29 TOOLBAR_TRANSITIONING, // Toolbar in progress of showing/hiding. |
| 30 // toolbarFraction is (0.0, 1.0). | 30 // toolbarFraction is (0.0, 1.0). |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // State of the NSMenuBAr |
| 34 enum MenuBarState { |
| 35 MENUBAR_SHOWN = 0, |
| 36 MENUBAR_HIDDEN, |
| 37 MENUBAR_TRANSITIONING |
| 38 }; |
| 39 |
| 33 } // namespace fullscreen_mac | 40 } // namespace fullscreen_mac |
| 34 | 41 |
| 35 // Provides a controller to fullscreen toolbar for a single browser | 42 // Provides a controller to fullscreen toolbar for a single browser |
| 36 // window. This class handles running animations, showing and hiding the | 43 // window. This class handles running animations, showing and hiding the |
| 37 // fullscreen toolbar, and managing the tracking area associated with the | 44 // fullscreen toolbar, and managing the tracking area associated with the |
| 38 // toolbar. This class does not directly manage any views -- the | 45 // toolbar. This class does not directly manage any views -- the |
| 39 // BrowserWindowController is responsible for positioning and z-ordering views. | 46 // BrowserWindowController is responsible for positioning and z-ordering views. |
| 40 // | 47 // |
| 41 | 48 |
| 42 // TODO (spqchan): Write tests for this class. See crbug.com/640064. | 49 // TODO (spqchan): Write tests for this class. See crbug.com/640064. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // the window is not on the primary screen, this should always be | 82 // the window is not on the primary screen, this should always be |
| 76 // |kFullScreenModeNormal|. This value can get out of sync with the correct | 83 // |kFullScreenModeNormal|. This value can get out of sync with the correct |
| 77 // state if we miss a notification (which can happen when a window is closed). | 84 // state if we miss a notification (which can happen when a window is closed). |
| 78 // Used to track the current state and make sure we properly restore the menu | 85 // Used to track the current state and make sure we properly restore the menu |
| 79 // bar when this controller is destroyed. | 86 // bar when this controller is destroyed. |
| 80 base::mac::FullScreenMode systemFullscreenMode_; | 87 base::mac::FullScreenMode systemFullscreenMode_; |
| 81 | 88 |
| 82 // Whether the omnibox is hidden in fullscreen. | 89 // Whether the omnibox is hidden in fullscreen. |
| 83 fullscreen_mac::SlidingStyle slidingStyle_; | 90 fullscreen_mac::SlidingStyle slidingStyle_; |
| 84 | 91 |
| 85 // The fraction of the AppKit Menubar that is showing. Ranges from 0 to 1. | 92 // The fraction of the AppKit Menubar that is showing. |
| 86 // Only used in AppKit Fullscreen. | |
| 87 CGFloat menubarFraction_; | 93 CGFloat menubarFraction_; |
| 88 | 94 |
| 89 // The state of the toolbar when the sliding style is set to | 95 // The state of the macOS NSMenuBar. |
| 90 // OMNIBOX_TABS_HIDDEN. | 96 MenuBarState menubarState_; |
| 91 fullscreen_mac::HiddenToolbarState hiddenToolbarState_; | 97 |
| 98 // Whether the macOS NSMenuBar is animating in or out. |
| 99 bool menubarAnimatingIn_; |
| 92 | 100 |
| 93 // A Carbon event handler that tracks the revealed fraction of the menu bar. | 101 // A Carbon event handler that tracks the revealed fraction of the menu bar. |
| 94 EventHandlerRef menuBarTrackingHandler_; | 102 EventHandlerRef menuBarTrackingHandler_; |
| 95 | 103 |
| 96 // True when the toolbar is dropped to show tabstrip changes. | 104 // True when the toolbar is dropped to show tabstrip changes. |
| 97 BOOL isRevealingToolbarForTabStripChanges_; | 105 BOOL isRevealingToolbarForTabStripChanges_; |
| 98 | 106 |
| 99 // True when the menubar is disappearing/gone and the toolbar should still be | 107 BOOL wasToolbarShowingWhenMenubarStartedAnimatingIn_; |
| 100 // shown. Set to false after the toolbar hides. | |
| 101 BOOL shouldShowToolbarWithoutMenu_; | |
| 102 } | 108 } |
| 103 | 109 |
| 104 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle; | 110 @property(nonatomic, assign) fullscreen_mac::SlidingStyle slidingStyle; |
| 105 | 111 |
| 106 // Designated initializer. | 112 // Designated initializer. |
| 107 - (id)initWithBrowserController:(BrowserWindowController*)controller | 113 - (id)initWithBrowserController:(BrowserWindowController*)controller |
| 108 style:(fullscreen_mac::SlidingStyle)style; | 114 style:(fullscreen_mac::SlidingStyle)style; |
| 109 | 115 |
| 110 // Informs the controller that the browser has entered or exited fullscreen | 116 // Informs the controller that the browser has entered or exited fullscreen |
| 111 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called | 117 // mode. |-setupFullscreenToolbarForContentView:showDropdown:| should be called |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 @interface FullscreenToolbarController (ExposedForTesting) | 175 @interface FullscreenToolbarController (ExposedForTesting) |
| 170 // Adjusts the AppKit Fullscreen options of the application. | 176 // Adjusts the AppKit Fullscreen options of the application. |
| 171 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; | 177 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; |
| 172 | 178 |
| 173 // Callback for menu bar animations. | 179 // Callback for menu bar animations. |
| 174 - (void)setMenuBarRevealProgress:(CGFloat)progress; | 180 - (void)setMenuBarRevealProgress:(CGFloat)progress; |
| 175 | 181 |
| 176 @end | 182 @end |
| 177 | 183 |
| 178 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ | 184 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |