| 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 |
| 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 @class FullscreenToolbarVisibilityLockController; |
| 19 @class ImmersiveFullscreenController; |
| 19 | 20 |
| 20 // This enum class represents the appearance of the fullscreen toolbar, which | 21 // This enum class represents the appearance of the fullscreen toolbar, which |
| 21 // includes the tab strip and omnibox. | 22 // includes the tab strip and omnibox. |
| 22 enum class FullscreenToolbarStyle { | 23 enum class FullscreenToolbarStyle { |
| 23 // The toolbar is present. Moving the cursor to the top | 24 // The toolbar is present. Moving the cursor to the top |
| 24 // causes the menubar to appear and the toolbar to slide down. | 25 // causes the menubar to appear and the toolbar to slide down. |
| 25 TOOLBAR_PRESENT, | 26 TOOLBAR_PRESENT, |
| 26 // The toolbar is hidden. Moving cursor to top shows the | 27 // The toolbar is hidden. Moving cursor to top shows the |
| 27 // toolbar and menubar. | 28 // toolbar and menubar. |
| 28 TOOLBAR_HIDDEN, | 29 TOOLBAR_HIDDEN, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 55 base::scoped_nsobject<FullscreenToolbarVisibilityLockController> | 56 base::scoped_nsobject<FullscreenToolbarVisibilityLockController> |
| 56 visibilityLockController_; | 57 visibilityLockController_; |
| 57 | 58 |
| 58 // Manages the toolbar animations for the TOOLBAR_HIDDEN style. | 59 // Manages the toolbar animations for the TOOLBAR_HIDDEN style. |
| 59 std::unique_ptr<FullscreenToolbarAnimationController> animationController_; | 60 std::unique_ptr<FullscreenToolbarAnimationController> animationController_; |
| 60 | 61 |
| 61 // Mouse tracker to track the user's interactions with the toolbar. This | 62 // Mouse tracker to track the user's interactions with the toolbar. This |
| 62 // object is only set when the browser is in fullscreen mode. | 63 // object is only set when the browser is in fullscreen mode. |
| 63 base::scoped_nsobject<FullscreenToolbarMouseTracker> mouseTracker_; | 64 base::scoped_nsobject<FullscreenToolbarMouseTracker> mouseTracker_; |
| 64 | 65 |
| 65 // Tracks the currently requested system fullscreen mode, used to show or | 66 // Controller for immersive fullscreen. |
| 66 // hide the menubar. This should be |kFullScreenModeNormal| when the window | 67 base::scoped_nsobject<ImmersiveFullscreenController> |
| 67 // is not main or not fullscreen, |kFullScreenModeHideAll| while the overlay | 68 immersiveFullscreenController_; |
| 68 // is hidden, and |kFullScreenModeHideDock| while the overlay is shown. If | |
| 69 // the window is not on the primary screen, this should always be | |
| 70 // |kFullScreenModeNormal|. This value can get out of sync with the correct | |
| 71 // state if we miss a notification (which can happen when a window is closed). | |
| 72 // Used to track the current state and make sure we properly restore the menu | |
| 73 // bar when this controller is destroyed. | |
| 74 base::mac::FullScreenMode systemFullscreenMode_; | |
| 75 } | 69 } |
| 76 | 70 |
| 77 @property(nonatomic, assign) FullscreenToolbarStyle toolbarStyle; | 71 @property(nonatomic, assign) FullscreenToolbarStyle toolbarStyle; |
| 78 | 72 |
| 79 // Designated initializer. | 73 // Designated initializer. |
| 80 - (id)initWithBrowserController:(BrowserWindowController*)controller; | 74 - (id)initWithBrowserController:(BrowserWindowController*)controller; |
| 81 | 75 |
| 82 // Informs the controller that the browser has entered or exited fullscreen | 76 // Informs the controller that the browser has entered or exited fullscreen |
| 83 // mode. |-enterFullscreenMode| should be called when the window is about to | 77 // mode. |-enterFullscreenMode| should be called when the window is about to |
| 84 // enter fullscreen. |-exitFullscreenMode| should be called before any views | 78 // enter fullscreen. |-exitFullscreenMode| should be called before any views |
| (...skipping 14 matching lines...) Expand all Loading... |
| 99 | 93 |
| 100 // Returns the fraction of the toolbar exposed at the top. | 94 // Returns the fraction of the toolbar exposed at the top. |
| 101 // It returns 1.0 if the toolbar is fully shown and 0.0 if the toolbar is | 95 // It returns 1.0 if the toolbar is fully shown and 0.0 if the toolbar is |
| 102 // hidden. Otherwise, if the toolbar is in progress of animating, it will | 96 // hidden. Otherwise, if the toolbar is in progress of animating, it will |
| 103 // return a float that ranges from (0, 1). | 97 // return a float that ranges from (0, 1). |
| 104 - (CGFloat)toolbarFraction; | 98 - (CGFloat)toolbarFraction; |
| 105 | 99 |
| 106 // Returns YES if the fullscreen toolbar must be shown. | 100 // Returns YES if the fullscreen toolbar must be shown. |
| 107 - (BOOL)mustShowFullscreenToolbar; | 101 - (BOOL)mustShowFullscreenToolbar; |
| 108 | 102 |
| 109 // Returns YES if the mouse is on the window's screen. This is used to check | |
| 110 // if the menubar events belong to window's screen since the menubar would | |
| 111 // only be revealed if the mouse is there. | |
| 112 - (BOOL)isMouseOnScreen; | |
| 113 | |
| 114 // Called by the BrowserWindowController to update toolbar frame. | 103 // Called by the BrowserWindowController to update toolbar frame. |
| 115 - (void)updateToolbarFrame:(NSRect)frame; | 104 - (void)updateToolbarFrame:(NSRect)frame; |
| 116 | 105 |
| 117 // Returns YES if the browser is in the process of entering/exiting | |
| 118 // fullscreen. | |
| 119 - (BOOL)isFullscreenTransitionInProgress; | |
| 120 | |
| 121 // Returns YES if the browser in in fullscreen. | 106 // Returns YES if the browser in in fullscreen. |
| 122 - (BOOL)isInFullscreen; | 107 - (BOOL)isInFullscreen; |
| 123 | 108 |
| 124 // Updates the toolbar style. If the style has changed, then the toolbar will | 109 // Updates the toolbar style. If the style has changed, then the toolbar will |
| 125 // relayout. | 110 // relayout. |
| 126 - (void)updateToolbarStyle; | 111 - (void)updateToolbarStyle; |
| 127 | 112 |
| 128 // Updates the toolbar by updating the layout, menubar and dock. | 113 // Updates the toolbar by updating the layout, menubar and dock. |
| 129 - (void)updateToolbar; | 114 - (void)updateToolbar; |
| 130 | 115 |
| 131 // Returns |browserController_|. | 116 // Returns |browserController_|. |
| 132 - (BrowserWindowController*)browserWindowController; | 117 - (BrowserWindowController*)browserWindowController; |
| 133 | 118 |
| 134 // Returns the object in |visibilityLockController_|; | 119 // Returns the object in |visibilityLockController_|; |
| 135 - (FullscreenToolbarVisibilityLockController*)visibilityLockController; | 120 - (FullscreenToolbarVisibilityLockController*)visibilityLockController; |
| 136 | 121 |
| 137 @end | 122 @end |
| 138 | 123 |
| 139 // Private methods exposed for testing. | 124 // Private methods exposed for testing. |
| 140 @interface FullscreenToolbarController (ExposedForTesting) | 125 @interface FullscreenToolbarController (ExposedForTesting) |
| 141 // Adjusts the AppKit Fullscreen options of the application. | 126 // Adjusts the AppKit Fullscreen options of the application. |
| 142 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; | 127 - (void)setSystemFullscreenModeTo:(base::mac::FullScreenMode)mode; |
| 143 | 128 |
| 144 // Callback for menu bar animations. | 129 // Callback for menu bar animations. |
| 145 - (void)setMenuBarRevealProgress:(CGFloat)progress; | 130 - (void)setMenuBarRevealProgress:(CGFloat)progress; |
| 146 | 131 |
| 147 @end | 132 @end |
| 148 | 133 |
| 149 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ | 134 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_TOOLBAR_CONTROLLER_H_ |
| OLD | NEW |